Multiple choice technology programming languages

How many bytes are used to represent the primitive data type int in Java ?

  1. 4

  2. 2

  3. 8

  4. The number of bytes to represent an int is compiler dependent.

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

Java specifies that int is exactly 4 bytes (32 bits) on all platforms. Unlike C/C++, Java primitive types have fixed sizes to ensure consistent behavior across different systems.