According to https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html a byte in Java is:
"The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). "
If I write the maximum value (127) in two's complement form in Java I am able to save it in a byte type.
byte positive127 = 0b01111111;
However, if I try to do the same for the minimum value -128 it is interpreted as an integer. I am not able to save it in a byte.
byte negative127 = 0b10000000;
Can someone explain to me why this is not possible when the documentation states that the byte type should be able to hold this value?
Thanks in advance!