Home » JAVA Programming » Basic Datatypes » Question
  1. What is the range of byte data type in Java?
    1. -128 to 127
    2. -32768 to 32767
    3. -2147483648 to 2147483647
    4. None of the mentioned
    5. NA
Correct Option: A

Byte occupies 8 bits in memory. We use the formula - 2(bits-1) to calculate the negative range, and we use 2(bits-1)–1 for the positive range.

So byte range is from - 2(8-1) to 2(8-1) -1 which is -128 to 127.



Your comments will be displayed only after manual approval.