键盘录入5个学生的信息(姓名,年龄,语文成绩,数学成绩,英语成绩),
按照总分排序,总分相同分别按照语文,数学,英语,年龄,姓名排序,
并且将排序的结果写入到文件当中保存起来
1.现在main方法外定义一个学生类
class Student{
private String name;
private int age;
private int chinese;
private int math;
private int english;
public Student() {
}
public Student(String name, int age, int chinese, int math, int english) {
this.name = name;
this.age = age;
this.chinese = chinese;
this.math = math;
this.english = english;
}
//获得总成绩的方法
public int getSum() {
//返回总成绩
return chinese + math + english;
}
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 getChinese() {
return chinese;
}
public void setChinese(int chinese) {
this