0
Explain to me this loop,🙄🙄
public class Numb { public static void main(String[] args) { int a = 128; byte b = (byte)a; System.out.println(b); // Outputs -128 a = 129; b = (byte)a; System.out.println(b); // Outputs -127 a = 130; b = (byte)a; System.out.println(b); // Outputs -126 a = 384; b = (byte)a; System.out.println(b); // Outputs -128 } }
1 Answer
+ 3
There is no loop, it's type overflow
https://www.tutorialspoint.com/Java-overflow-and-underflow
In general:
https://en.m.wikipedia.org/wiki/Integer_overflow



