public class DeptVO {
private String deptName;
private int num;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
public class Test {
public static void main(String[] args) {
DeptVO dept1 = new DeptVO();
dept1.setDeptName("财务部");
dept1.setNum(1);
DeptVO dept2 = new DeptVO();
dept2.setDeptName("信息技术部");
dept2.setNum(2);
DeptVO dept3 = new DeptVO();
dept3.setDeptName("设备管理部");
dept3.setNum(3);
Map map = new HashMap();
map.put("财务部", dept1);
map.put("信息技术部", dept2);
map.put("设备管理部", dept3);
DeptVO dept = map.get("信息技术部");
System.out.println("信息技术部的数是:"+dept.getNum());
}
}