What is the result?

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?
A. Compilation fails.
B. An 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]

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.