I though that the following pieces of code does not compile. However after running it I got unexpected result, I don't understand how it is printing -2
? can you explain how addition is done here?
int x = 2147483647+2147483647; // it compiles
System.out.print(x); // prints -2
any explain is welcome