ควิซ Java: Operators & Integer Division

This Java operators quiz focuses on the results that surprise beginners, above all integer division. You will predict output with /, %, ++, compound assignment and string concatenation, and see why && can protect you from an exception.

ง่าย 10 ข้อ ~5 นาที ผ่านที่ 80% Java 17

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

ตัวอย่างคำถาม

ข้อ 1 จาก 10

What does this print?

public class Main {
    public static void main(String[] args) {
        System.out.println(7 / 2);
    }
}
ดูเฉลย

B. 3 Both operands are int, so Java does integer division and drops the fraction (it does not round). The result is the int 3.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • Integer division vs floating-point division
  • The remainder operator % with negative numbers
  • Dividing by zero with int and with double
  • Prefix and postfix ++
  • Short-circuit && and + with strings

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง