Font size:
Print
Question: What will be the output of the program?
TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext())
System.out.print(it.next() +"");
}
1. one two three four
2. four three two one
3. four one three two
4. one two three four one
Check Answer
TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext())
System.out.print(it.next() +"");
}
1. one two three four
2. four three two one
3. four one three two
4. one two three four one
Check Answer