The byte primitive

suggest change

A byte is an 8-bit signed integer. It can store a minimum value of -2^7 (-128) and a maximum value of 2^7 - 1 (127).

byte example = -36;
byte myByte = 96;
byte anotherByte = 7;

byte addedBytes = (byte) (myByte + anotherByte); // 103
byte subtractedBytes = (byte) (myByte - anotherByte); // 89

The maximum and minimum values of byte can be found at:

byte high = Byte.MAX_VALUE;        // high == 127
byte low = Byte.MIN_VALUE;         // low == -128

The default value of a byte field is 0.

byte defaultByte;    // defaultByte == 0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents