Junior — Middle
What is the memory size occupied by an int type variable in bytes?
sobes.tech AI
Answer from AI
In Java, a variable of type int occupies 4 bytes (32 bits) of memory. This fixed size is defined by the language specification and does not depend on the platform.
Example:
int number = 100;
System.out.println(Integer.BYTES); // Will output 4