class Test
{
public static void main(String args[])
{
HashMap hm = new HashMap();
Object o = new Test1(1);
hm.put(o, "Hello");
System.out.println(hm.get(o));
}
}
class Test1
{
private int i;
Test1(int i)
{
this.i = i;
}
..................
}