JAVA Programming :: Inheritance - Discussion
Home > JAVA Programming > Inheritance > MCQs Questions Discussion
4 / 9
What is the output for the below code?
import javutil.Iterator;
import javutil.TreeSet;
public class Test {
public static void main(String... args) {
TreeSet s1 = new TreeSet();
s1.add("one");
s1.add("two");
s1.add("three");
s1.add("one");
Iterator it = s1.iterator();
while (it.hasNext() ) {
System.out.print( it.next() + " " );
}
}
}
import javutil.Iterator;
import javutil.TreeSet;
public class Test {
public static void main(String... args) {
TreeSet s1 = new TreeSet();
s1.add("one");
s1.add("two");
s1.add("three");
s1.add("one");
Iterator it = s1.iterator();
while (it.hasNext() ) {
System.out.print( it.next() + " " );
}
}
}
Aone three two
BRuntime Exception
Cone three two one
Done two three
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!