java Map接口2
public static void main(String[] args){ em e1=new em(1,"me",100); em e2=new em(2,"she",1000); em e3=new em(3,"he",10000); Map<Integer,em> map=new HashMap<>(); map.put(10, e1); map.put(11, e2); map.put(13, e3); em e5=map.get(11);}}em(int id,String name,double salary){ this.id=id; this.name=name; this.salary=salary;}public int getId() { return id;}public void setId(int id) { this.id = 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;}
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。