Oracle
1Z0-829 · Question #8
1Z0-829 Question #8: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-829 to reveal the answer and full explanation for question #8. The question stem and answer options stay visible for context.
Controlling Program Flow
Question
Given:
public class Test {
public static void main(String[] args) {
final int x = 2;
int y = x;
while (y<3) {
switch (y) {
case 0+x:
y++;
case 1:
y++;
}
}
System.out.println(y);
}
}
What is the result?
Options
- A4
- B2
- C6
- DNothing is printed because of an indefinite loop.
- ECompilation fails.
- F5
- GA runtime exception is thrown.
- H3
Unlock 1Z0-829 to see the answer
You've previewed enough free 1Z0-829 questions. Unlock 1Z0-829 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
#switch statements#final variables#constant expressions#compilation