public class Student implements Comparable<Student> {
private String name;
private int score;
public Student(String name, int score) {
this.name = name;
this.score = score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String toString(){
return name +"...."+ score;
}
@Override
public int compareTo(Student stu) {
int num = this.score - stu.score;
return num==0?this.name.compareTo(stu.name):num;
}