What is the result?

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?

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?

A.
Compilation fails.

B.
An 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]



Leave a Reply 1

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


syam

syam

[606, 608, 609, 610, 612] [608, 609, 610] is the output.

F is correct answer.