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

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-14
Posted on: July 17, 2010 at 12:00 AM
Advertisement
The Sample code given below test you understanding about the Collection Interface, ArrayList class and HashSet class of Collection framework.

Given below the sample code :

import java.util.*
public class Demo{
enum test{FIRST,SECOND,THIRD}
public static void main(String args[])
{
Collection myCol=new ArrayList();
myCol.add(test.THIRD);
myCol.add(test.THIRD);
myCol.add(test.THIRD);
myCol.add(test.SECOND);
myCol.add(test.SECOND);
myCol.add(test.ONE);
Set myset=new HashSet(mycol)
}

Which statement given below is correct for the code above ?

1.The set contains all 6 elements of collection in the given order.

2.The set contains only 3 elements of collection in the given order.

3.The set contains all 6 elements of collection but not in the given order.

4.The set contains only 3 elements of collection but not in the given order.

Answer

(4)

Advertisement

Related Tags for SCJP Module-9 Question-14:


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