I have the following code:
System.out.println(0b11111111);
System.out.println((byte) 0b11111111);
First row prints
255
and the second row prints
-1
Please, can someone explain me why the results are different? How does (byte)
casting change 0b11111110
number that it becomes -1
?
Thank you!