1.  >>  国开 / 面向对象程序设计
 国开 / 面向对象程序设计

public class SetTest {

public static void main(String[] args) {

HashSet hs = new HashSet();

boolean b1 = hs.add("a");

hs.add("b");

hs.add("c");

hs.add("d");

hs.add("d");

boolean b2 = hs.add("a");

System.out.println("size="+hs.size());

}

}
size=5
size=4
 参考答案:
 佳题速递: