本帖最后由 Maple_枫 于 2014-4-5 11:40 编辑
public class Student implements Comparable{
private String name;
private Integer age;
private double score;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
public Student(String name, Integer age, double score) {
super();
this.name = name;
this.age = age;
this.score = score;
}
public Student() {
super();
}
@Override
public int compareTo(Object o) {//这行报错,不知道怎么搞,望大神解答下
if(((Student)o).getScore()>=this.getScore()){
return 1;
}
return -1;
}
}
|