0
我需要打印用戶輸入的員工的詳細信息。到目前爲止,我所能得到的只是名字。任何人都可以幫我一把嗎?HashMap上的搜索方法
EmployeeStore
public void add(Employee employee)
{
map.put(employee.getEmployeeName(), employee);
}
public Employee searchByName(String name)
{
System.out.println(name);
return map.get(name);
}
使用
EmployeeStore Store = new EmployeeStore();
Store.add(new Employee ("James O' Carroll", 18,"hotmail.com"));
Store.add(new Employee ("Andy Carroll", 1171,"yahoo.com"));
Store.add(new Employee ("Luis Suarez", 7,"gmail.com"));
Store.searchByName("James O' Carroll");
'EmployeeStore'的add方法是怎麼樣的? – EyalAr
我會將它添加到我的代碼中。 – Pendo826
您從searchByName獲得一位員工,有什麼問題? –