日期:2014-05-20 浏览次数:20840 次
import Employee ;
import java.util.Hashtable;
public class Test{
public static void main(String []args){
Hashtable<Integer,Employee> ht = new Hashtable<Integer,Employee>();
ht.put(100,new Employee(111,"杨幂",111111));
ht.put(101,new Employee(222,"家驹",111));
Employee e = ht.get(100);
e.showInfo();
}
}
class Employee{
private final int id;
private String name;
private double salary;
public Employee(int id,String name,double salary){
this.id=id;
this.name=name;
this.salary=salary;
}
public int getId(){
return id;
}
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
public double getSalary(){
return salary;
}
public void setSalary(double salary){
this.salary=salary;
}
public void showIofo(){
System.out.println(id+"\t"+name+"\t"+salary);
}
}