Vidyalelo
Java Programming · Q34

Data Types and Variables

Programming · Java Programming · question 34

Q34

Size of int in Java is

A.
16 bit
B.
32 bit
Answer
C.
64 bit
D.
Depends on execution environment

Answer: Option B

Solution

Answer: Option B
Solution:
The size of an int in Java is 32 bits.

Here's the breakdown:

Option A: 16 bit - This is not correct. The int data type in Java is 32 bits in size, not 16 bits.

Option B: 32 bit - This is the correct size of an int in Java. An int occupies 32 bits of memory in Java, allowing it to represent a wide range of whole numbers.

Option C: 64 bit - This size is not correct for an int in Java. A 64-bit data type is larger and typically used for long integers.

Option D: Depends on execution environment - The size of an int in Java is standardized and is always 32 bits regardless of the execution environment. It is not dependent on the platform or execution environment.

So, the correct size of an int in Java is 32 bits.