Q: What is the range of the short data type in Java?
-
A
-128 to 127
-
B
-32768 to 32767
-
C
0 to 65535
-
D
-2147483648 to 2147483647
B
Answer:
B
Explanation:
The short data type in Java is a 16-bit signed integer, which means it can store values ranging from -32768 to 32767. This range allows it to represent a wide variety of numerical values within a relatively compact memory space. The short data type is often used in scenarios where memory efficiency is critical, or when dealing with numbers that fall within the specified range.
Related Topic:
Share Above MCQ