Java-Quiz: 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.

Leicht 10 Fragen ~5 Minuten Bestanden ab 80% Java 17

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 10

What does this print?

public class Main {
    public static void main(String[] args) {
        System.out.println(7 / 2);
    }
}
Lösung zeigen

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.

Darum geht es in diesem Quiz

  • 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

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.