Quiz de Java: Primitives & Variables

This Java quiz checks how well you know the eight primitive types and how variables behave. You will predict output involving overflow, char arithmetic, default values and var, and spot code that does not compile.

Fácil 10 perguntas ~5 minutos Aprovação com 80% Java 17

Escolha um modo

Jogando como visitante: entre para guardar seu XP e sua sequência.

Pergunta de exemplo

Pergunta 1 de 10

What does this print?

public class Main {
    public static void main(String[] args) {
        int x = Integer.MAX_VALUE;
        x = x + 1;
        System.out.println(x);
    }
}
Mostrar a resposta

B. -2147483648 An int is 32 bits, so adding 1 to Integer.MAX_VALUE silently wraps around to Integer.MIN_VALUE. Java does not throw on integer overflow.

O que este quiz cobre

  • The primitive types and their fixed sizes
  • Integer overflow and long literals
  • char as a number and double precision
  • Default values of fields vs uninitialized local variables
  • Type inference with var

Perguntas frequentes

Preciso de uma conta?

Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.

Posso refazer?

Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.