Let's have a simple code as below
public class Sandbox {
public static void run(String[] args) {
int i = Integer.MAX_VALUE;
int j = i+1;
System.out.println(i);
System.out.println(j);
}
}
This will print output
2147483647
-2147483648
Value at j is overlowed without any notice to me when the code is executed.
I use Netbeans IDE to run this code.
Is it possible to configure the system to notify us when such arithmetic overflow occurs?