public class HomeWork05 {
public static void main(String[] args) {
Person p1 = new Person("张小白",18);
Person p2 = new Person("张三",19);
Person p3 = new Person("李四",20);
Person p4 = new Person("张小白",18);
HashSet<Person> list = new HashSet<>();
list.add(p1);
list.add(p2);
list.add(p3);
list.add(p4);
System.out.println(list);
for(Person p : list){
System.out.println(p);
}
}
} |
|