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.

Средний 10 вопроса ~6 минуты Проходной балл: 80% Java 17

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

public class Main {
    public static void main(String[] args) {
        System.out.println('a' + 1 + "b" + 'a' + 1);
    }
}
Показать ответ

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.

Что проверяет этот квиз

  • 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

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.