I tried executing the below code :
public class Test5 {
/**
* @param args
*/
public static void main(String[] args) {
short x = 0;
int i = 123456;
x = (short) (x + i);
System.out.println(x);
}
}
How is the output "-7616"? how does integer and short work when type casted to short?