Oracle
1Z0-808 · Question #97
1Z0-808 Question #97: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #97. The question stem and answer options stay visible for context.
Using Loop Constructs
Question
Given:
public class Test2 {
public static void main(String[] args) {
int ar1[] = {2, 4, 6, 8};
int ar2[] = {1, 3, 5, 7, 9};
int ar3[] = ar1;
for (int e2 : ar2) {
System.out.print("" + e2);
}
}
}
What is the result?Options
- A2 4 6 8
- B2 4 6 8 9
- C1 3 5 7
- D1 3 5 7 9
- ECompilation fails
- FAn exception is thrown at runtime
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
#Array reference#Enhanced for loop#Loop iteration#Code flow