Oracle
1Z0-851 · Question #99
1Z0-851 Question #99: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #99. The question stem and answer options stay visible for context.
Question
Given: 1. import java.util.*; 2. 3. public class Explorer3 { 4. public static void main(String[] args) { 5. TreeSet<Integer> s = new TreeSet<Integer>(); 6. TreeSet<Integer> subs = new TreeSet<Integer>(); 7. for (int i = 606; i < 613; i++) 8. if (i % 2 == 0) 9. s.add(i); 10. subs = (TreeSet) s.subSet(608, true, 611, true); 11. subs.add(629); 12. System.out.println(s + " " + subs); 13. } 14.} 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.