Multiple choice

In Java, each integer variable occupies ________ byte(s) of memory.

  1. 2

  2. 4

  3. 6

  4. 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Java, the int primitive type is a 32-bit signed integer, which occupies 4 bytes of memory. This is consistent across all JVM implementations, making int platform-independent in size, unlike in some other languages where integer size can vary.