class Student implements Comparable<Student>{
private String name;
private int age;
private int score;
public Student(String name, int age){
this.setName(name);
this.setAge(age);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
Set<Student> se = mp.keySet();
Iterator<Student> it = se.iterator();
while (it.hasNext()){
Student stu =it.next();
int val = mp.get(stu); //运行到这的时候出现NullPointerException异常,求真相,没找出来什么原因,我也么发现我哪里写错了啊
System.out.println(stu +",成绩: "+ val);
}
}
}