Javaの問題
問題
import java.util.*;
public class CollectionTest{
private String s;
public CollectionTest(String s){this.s = s;}
public static void main(String[] args){
HashSet<Object> hs = new HashSet<Object>();
CollectionTest ct1 = new CollectionTest("abcdefg");
CollectionTest ct2 = new CollectionTest("abcdefg");
String s1 = new String("abcdefg");
String s2 = new String("abcdefg");
hs.add(ct1);
hs.add(ct2):
hs.add(s1):
hs.add(s2):
System.out.println(hs.size());
}
}
public class CollectionTest{
private String s;
public CollectionTest(String s){this.s = s;}
public static void main(String[] args){
HashSet<Object> hs = new HashSet<Object>();
CollectionTest ct1 = new CollectionTest("abcdefg");
CollectionTest ct2 = new CollectionTest("abcdefg");
String s1 = new String("abcdefg");
String s2 = new String("abcdefg");
hs.add(ct1);
hs.add(ct2):
hs.add(s1):
hs.add(s2):
System.out.println(hs.size());
}
}
問題番号:1505211430321作成者:ヘウォン