package cn.edu.bjut.chapter6; import java.util.HashSet; import java.util.Set; public class NameTester { public static void main(String[] args) { Set names = new HashSet(); names.add(new Name("Albert", "Einstein")); names.add(new Name("albert", "einstein")); names.add(new Name("Issac", "Netwon")); names.add(new Name("issac", "Netwon")); System.out.println(names); // names中只有两个元素 } }