Java Collection Program Test-5

What will be the output of the following java code?

import java.util.*;

public class Test {

private String str;

public Test(String str) {

this.str = str;

}

public static void main(String[] args) {

HashSet hs = new HashSet();

Test t1 = new Test("java");

Test t2 = new Test("java");

String s1 = new String("spring");

String s2 = new String("spring");

hs.add(t1);

hs.add(t2);

hs.add(s1);

hs.add(s2);

System.out.println(hs.size());

}

}

What will be the output of the following java code?

import java.util.*;

enum Hello {

FOUR,FIVE

}

public class Test {

public static void main(String[] args) {

List list = new ArrayList();

list.add(Hello.FIVE);

list.add(Hello.FIVE);

list.add(Hello.FIVE);

list.add(Hello.FOUR);

list.add(Hello.FOUR);

Set st = new HashSet(list);

System.out.println(st);

}

}