πŸ“Š JAVA
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) 3 2 1

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
356
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Tina Singh
Publisher
πŸ“ˆ
98%
Success Rate