As per JLS,
narrowing primitive conversion may be used if all of the following conditions are satisfied:
(1) The expression is a constant expression of type byte, short, char or int.
(2) The type of the variable is byte, short, or char.
(3) The value of the expression (which is known at compile time, because it is a constant expression) is representable in the type of the variable.
Also, If the type of the expression cannot be converted to the type of the variable by a conversion permitted in an assignment context, then a compile-time error occurs.
This is what dictates the results of the code
HTH
Sandeep Nachane
------------------
www.tipsmart.com: