Vidyalelo
Java Programming · Q107

Java Collections Framework

Programming · Java Programming · question 107

Q107

What will be the output of the following Java program? import java.util.*; class Output public static void main(String args[]) TreeSet t = new TreeSet(); t.add("3"); t.add("9"); t.add("1"); t.add("4"); t.add("8"); System.out.println(t);

A.
[1, 3, 5, 8, 9]
B.
[3, 4, 1, 8, 9]
C.
[9, 8, 4, 3, 1]
D.
[1, 3, 4, 8, 9]
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board