Question 78 / 90:  Given the following code, what will happen?
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 );

A  "200" will be printed to standard out.
B  The code will not compile due to issues with the declarations.
C  The code will not compile due to an issue with the expression in the print statement.
<< First < Previous Next > Last >>
Explanation:

A. The widening and narrowing that occurs in the declaration is all acceptable. Also, implicit casts occur in the print statement.

B and C are incorrect as the code compiles fine without any compilation issues.

Exam Home Page
https://www.jobilize.com/quiz-my-oca-mock-exam-by-mike-wolf

My OCA Mock

Author:

Access: Public Instant Grading

Ask
Sean WiffleBoy
Start Quiz
Edgar Delgado
Start Quiz
Sarah Warren
Start Test
Joanna Smithback
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/quiz-my-oca-mock-exam-by-mike-wolf" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>