Multiple choice technology programming languages

The type long in java can be used to store values in the following range:

  1. -231 to 231 - 1

  2. -232 to 232 - 1

  3. -264 to 264

  4. -263 to 263 - 1

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

Java's long type is a 64-bit signed integer. The range is -2^63 to (2^63 - 1), which equals -9223372036854775808 to 9223372036854775807.

AI explanation

Java's long is a 64-bit signed two's-complement integer type, so its range runs from -2^63 to 2^63 - 1. The int type is the one bounded by -2^31 to 2^31 - 1, and there is no unsigned equivalent in standard Java for these primitives, so the -2^63 to 2^63 - 1 range is correct for long.