Multiple choice technology programming languages

What is the legal range of a byte integral type?

  1. 0 - 65, 535

  2. (-128) - 127

  3. (-32,768) - 32,767

  4. (-256) - 255

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

The byte type in Java is a signed 8-bit integer, which can represent values from -128 to 127. This range is calculated as -2^7 to 2^7-1. Option A shows the range for unsigned 16-bit (char), Option C is for short (16-bit signed), and Option D is incorrect. Option B is correct.