If either operand is of type double, the other is converted to double. Otherwise, if either operand is of type float, the other is converted to float. Otherwise, if either operand is of type long, the other is converted to long. Otherwise, both operands are converted to type int.
so, you need to change your code to something like this: Short obj2 = new Short( (short) (1-2) ); //line 2
Yes, the previous responder is exactly right. You are casting the operands which must be fully evaluated before the binary operation can be performed. Thus your cast operators are meaningless. If you cast the result instead of the operands it will work.
Download a copy of <a href="http://www.javarules.com" target="_blank" rel="nofollow"><i>"Mastering The Fundamentals of The Java Programming Language"</i></a>