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.
(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.