The byte primitive
suggest changeA 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents