/**
* 构造器,不多说哈,你懂的
* @param name
* @param ma
* @param cn
* @param en
*/
Student(String name,int ma,int cn,int en)
{
this.name = name;
this.ma = ma;
this.cn = cn;
this.en = en;
sum = ma + cn + en;
}
/**
* compareTo方法是上面类声明实现Comparable接口要实现的方法
*/
@Override
public int compareTo(Student s)
{
int num = new Integer(this.sum).compareTo(new Integer(s.sum));
if(num==0)
return this.name.compareTo(s.name);
return num;
}