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

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-16
Posted on: July 17, 2010 at 12:00 AM
Advertisement
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)

Advertisement

Related Tags for SCJP Module-9 Question-16:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 17, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com