import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String args[]) {
Person p1 = new Person("Ramesh", 30);
Person p2 = new Person("Sathish", 31);
Person p3 = new Person("Sathish", 31);
Person p4 = p1;
Map<Person,Integer> map=new HashMap<>();
map.put(p1,1);
map.put(p2,2);
System.err.println(map.put(p3,3));
System.err.println(map.put(p4,4));
System.out.println(map.size());
map.forEach((k,v) -> System.err.println(k+" "+v));
}
}
class Person {
private String name;
private int age;
public Person(String name,int age) {
this.name=name;
this.age=age;
}
@Override
public String toString() {
return this.name;
}
}