Oracle
1Z0-851 · Question #4
1Z0-851 Question #4: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #4. The question stem and answer options stay visible for context.
Question
Given: import java.util.*; public class Explorer2 { 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(629); System.out.println(s + " " + subs); } } What is the result?
Options
- ACompilation fails.
- BAn exception is thrown at runtime.
- C[608, 610, 612, 629] [608, 610]
- D[608, 610, 612, 629] [608, 610, 629]
- E[606, 608, 610, 612, 629] [608, 610]
- F[606, 608, 610, 612, 629] [608, 610, 629]
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.