A

Admin • 828.70K Points
Coach

Q. What will be the output of given code

Code:
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class ConcurrentSkipListMapTest {
public static void main (String args)
{
Set set = new TreeSet();
set.add(1);
set.add(“2”);
set.add(3);

Iterator iterator = set.iterator();
while (iterator. hasNext())
{
System. out. print(iterator. next()+””);
}
}

}
  • (A) 1 2 3
  • (B) 1 followed by exception
  • (C) Compile time exception
  • (D) 3 2 1
  • Correct Answer - Option(D)
  • Views: 9
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.