*/
public class Test04 {
public static void main(String[] args) throws Exception {
TreeSet<Student> t = new TreeSet<Student>(new Comparator<Student>(){
@Override
public int compare(Student s1, Student s2) {
// TODO Auto-generated method stub
int num = s1.getToal() - s2.getToal();
int num2 = (num == 0) ? s1.getName().compareTo(s2.getName()) : num ;
return num2;
}
});
Scanner sc = new Scanner(System.in);
for(int x = 0 ; x < 5 ; x++){
System.out.println("请您输入学生姓名");
String name = sc.nextLine();
System.out.println("请您输入学生的语文成绩");
String c = sc.nextLine();
int chinaeseScore = Integer.parseInt(c);
System.out.println("请您输入学生的数学成绩");
String m = sc.nextLine();
int mathScore = Integer.parseInt(m);
System.out.println("请您输入学生的英语成绩");
String e = sc.nextLine();
int englishScore = Integer.parseInt(e);
t.add(new Student(name , chinaeseScore , mathScore , englishScore));
}