Oracle
1Z0-851 · Question #101
1Z0-851 Question #101: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #101. The question stem and answer options stay visible for context.
Question
Given: import java.util.*; public class Explorer1 { public static void main(String[] args) { TreeSet<Integer> s = new TreeSet<Integer>(); TreeSet<Integer> subs = new TreeSet<Integer>(); for(int i = 606; i < 613; i++) if(i%2 == 0) s.add(i); subs = (TreeSet)s.subSet(608, true, 611, true); s.add(609); System.out.println(s + " " + subs); } } What is the result?
Options
- ACompilation fails.
- BAn exception is thrown at runtime.
- C[608, 609, 610, 612] [608, 610]
- D[608, 609, 610, 612] [608, 609, 610]
- E[606, 608, 609, 610, 612] [608, 610]
- F[606, 608, 609, 610, 612] [608, 609, 610]
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 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.