0

Why the result is true?

System.out.print(Integer.MAX_VALUE+1==Integer.MIN_VALUE);

11th Jul 2018, 8:21 PM
Caty Zurano
Caty Zurano - avatar
2 Antworten
+ 2
overflow Numbers are represented by a finite number of bits. imagine max int has 1111111 in binary and if you add 1 you will overflow and reach 0000000 which is min int It's not exactly like this, because of sign bit but you get the idea
11th Jul 2018, 8:33 PM
Matthias
Matthias - avatar
0
Jay. is that C#?
11th Jul 2018, 8:38 PM
Caty Zurano
Caty Zurano - avatar