Home Tutorial Java Scjp Part9 SCJP Module-9 Question-16

 
 

SCJP Module-9 Question-16
Posted on: July 17, 2010 at 12:00 AM
The Sample code given below will test your understanding of Collection framework of Java.

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();

Answer

(4)

Related Tags for SCJP Module-9 Question-16:


Ask Questions?

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.