class Person{
public String name;
public int age;
public Person(String name,int age){
this.name=name;
this.age=age;
}
public int hashCode(){
return age;
}
}
class reflectdemo{
public static void main(String[] args){
Person p1=new Person("p1",21);
Person p2=new Person("p2",22);
Person p3=new Person("p3",23);
Person p4=new Person("p4",24);
HashSet<Person> hs=new HashSet<Person>();
hs.add(p1);
hs.add(p2);
hs.add(p3);
hs.add(p4);
System.out.println(hs.size());
p4.age=25;
System.out.println(hs.remove(p4));
System.out.println(hs.size());
}
}