Oracle
1Z0-808 · Question #39
1Z0-808 Question #39: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #39. The question stem and answer options stay visible for context.
Working With Java Data Types
Question
public static void main(String[] args) {
Short s1 = 200;
Integer s2 = 400;
long s3 = (long) (s1 + s2); //line n1
String s4 = (String) (s3 * s2); //line n2
System.out.println("Sum is " + s4);
}
What is the result?
Options
- ASum is 600
- BCompilation fails at line n1.
- CCompilation fails at line n2.
- DA ClassCastException is thrown at line n1.
- EA ClassCastException is thrown at line n2.
Unlock 1Z0-808 to see the answer
You've previewed enough free 1Z0-808 questions. Unlock 1Z0-808 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Auto-boxing/unboxing#Type casting#Type promotion#String conversion