The 11th question of the assessment
test:
Which of the following expressions compile without error? (Choose all that apply.)
A. int monday = 3 + 2.0;
B. double tuesday = 5_6L;
C. boolean wednesday = 1 > 2 ? !true;
D. short thursday = (short)Integer.MAX_VALUE;
E. long friday = 8.0L;
F. var saturday = 2_.0;
G. None of the above
And the fragment of the explanation for answer D. (with the proposed correction):
Option D is correct. Even though the int value is larger than a short, it is implicitly explicitly cast to a short.