-
What is the output of this program?
import java.util.*;
public class TreeSet_Example
{
public static void main(String args[])
{
TreeSet object = new TreeSet();
object.add("7");
object.add("0");
object.add("9");
object.add("5");
object.add("6");
System.out.println(object);
}
}
-
- Runtime Error
- Compilation Error
- [0, 5, 6, 7, 9]
- [6, 7, 9]
- [0, 5, 6, 7]
Correct Option: C
TreeSet class uses set to store the values added by function add in ascending order using tree for storage