This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Select the valid primitive assignments of the following. A.int i = 10; char c = i; B.float f; long l = 100L; f = l; C.short s = 20; char c = s; D.byte b = 20; char c = b; E.short s1 = 10; short s2 = 20; short result = s1*s2; This is a question from JVALTEST answer given ia a and b which i think is wrong. Shouldnt it be only b?
Originally posted by Alan Chong: Why not b and d ? d is definitely correct.
Please note : 5.1.3 Narrowing Primitive Conversions The following 23 specific conversions on primitive types are called the narrowing primitive conversions: byte to char short to byte or char char to byte or short