How does java primitives work? , short(short+ int)?
<p>I tried executing the below code :</p>

<pre><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);
}

}
</code></pre>

<p>How is the output "-7616"? how does integer and short work when type casted to short?</p>
