Given below the sample code :
1. import java.util.*;
2. public class Demo {
3. public static void main(String[] args) {
4. // insert code here
5. t.add(new Integer(2));
6. t.add(new Integer(1));
7. System.out.println(t);
8. }
9. }
Which line given below should place at line 4 to give output [1, 2] , by the above code?
1. Set set = new LinkedHashSet();
2. Set set = new SortedSet();
3. Set set = new HashSet();
4. Set set = new TreeSet();
(4)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.