老师,你好!Map实体类做key,有什么需要注意的
//学生信息 -- 拓展信息
Map<Student, String> map = new HashMap<Student, String>(16);
map.put(new Student("zhangsan", 22), "优秀学生");
map.put(new Student("lisi", 22), "三好学生");
for (Student student : map.keySet()) {
System.out.println("key = " + student);
System.out.println("key.name = " + student.getName());
System.out.println("key.age = " + student.getAge());
System.out.println("value = " + map.get(student));
}