public static void main(String[] args) {
Hashtable s = new Hashtable();
s.put(new MyKey("zhangsan",20),new Integer(1));
s.put(new MyKey("lisi",23),new Integer(2));
Enumeration e = s.keys();
while(e.hasMoreElements())
{
MyKey mk = (MyKey)e.nextElement();
System.out.println(mk.name+","+mk.age+":"+s.get(mk));
}
}
}
class MyKey {
public String name = "unknown";
public int age = 0;
/**
* Method Mykey
*
*
*/
public MyKey(String name,int age) {
this.name = name;
this.age = age;
}