Output-Based Java Questions

This Java quiz is a set of classic "what is the output?" questions from interviews and written tests. Each one hides a rule about operators, overloading, initialization order or number types that you need to know cold.

Mittel 10 Fragen ~6 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('a' + 1 + "b" + 'a' + 1);
    }
}
Lösung zeigen

B. 98ba1 + is evaluated left to right. 'a' + 1 is char + int, so it is numeric addition: 97 + 1 = 98. Once a String appears, everything after it is concatenated as text.

Darum geht es in diesem Quiz

  • char arithmetic and string concatenation order
  • Pre- and post-increment in one expression
  • Overload resolution with null
  • Static blocks, instance blocks and constructors
  • Rounding, overflow, Infinity and NaN

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.