0
Why output is "127"
public class Program { public static void main(String[] args) { byte x =-128; --x; System .out .println (x); } }
2 Respostas
+ 6
The byte primitive data type has a range from -128 to +127.
If you decrease the minimum amount then it overflows to the maximum.
https://www.w3schools.com/java/java_data_types.asp
+ 4
That's because of 'overflow'.
Each number type has a certain range of numbers it can contain, depending on the allocated memory.
If the number goes out of range, it jumps to the other end of the spectrum.