1: public static void main(String[] args) {
2: Set<Person> set = new HashSet<Person>();
3: Person p1 = new Person("张三",20);
4: Person p2 = new Person("李四",21);
5: Person p3 = new Person("王五",22);
6: set.add(p1);
7: set.add(p2);
8: set.add(p3);
9:
10: p3.setAge(2); //修改p3的年龄
11: set.remove(p3); //无法删除
12: