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

 
 

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

Related Tags for SCJP Module-9 Question-14:


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.