long longValue = 100; byte b = (byte) (short) (int) longValue; // narrowing bte byteValue = 100; long l = (long) (int) (short) byteValue; // widening System.out.println( b + l );
byte b = (byte) (short) (int) longValue; // narrowing
bte byteValue = 100;
long l = (long) (int) (short) byteValue; // widening
System.out.println( b + l );
B and C are incorrect as the code compiles fine without any compilation issues.
My OCA Mock
Access: Public Instant Grading
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use.