package Test;
import java.util.TreeSet;
/**
* Student("Tom",24, 89)
* Student("Robin",32, 99));
* Student("Jerry",24, 99));
* Student("Lili",23, 87));
* Student("Jack",22, 87));
* Student("LiLei",25, 95));
* Student("Robin",32 ,99));
* @author ºú¹âÃ÷
*
*/
public class StudentTest {
public static void main(String[] args) {
//½¨Á¢¼¯ºÏ¶ÔÏó
TreeSet<Student> ts = new TreeSet<Student>();
//½¨Á¢ÔªËضÔÏó
Student s1 = new Student("Tom",24, 89);
Student s2 = new Student("Robin",32, 99);
Student s3 = new Student("Jerry",24, 99);
Student s4 = new Student("Lili",23, 87);
Student s5 = new Student("Jack",22, 87);
Student s6 = new Student("LiLei",25, 95);
Student s7 = new Student("Robin",32 ,99);
//Ìí¼ÓÔªËØ
ts.add(s1);
ts.add(s2);
ts.add(s3);
ts.add(s4);
ts.add(s5);
ts.add(s6);
ts.add(s7);
//±éÀú
for (Student student : ts) {
System.out.println(student.toString());
}
}
}
|