/**
* @author 墨风
*/
public class Student implements Comparable{
//名字
String name;
//分数
int score;
int age;
public Student(String name,int score){
this.name = name;
this.score = score;
}
public String toString(){
return name+"得了"+score+"分";
}
public boolean equals(Object o){
if(this==o){
return true;
}
if(o instanceof Student){
Student stu = (Student) o;
if(stu.name.equals(this.name)&&(stu.score==this.score)){
return true;
}
}
return false;
}
public int hashCode(){
return score/10;
}
23行的this指的是