一、在對象中實現Comparable接口 public class Student2 implements Comparable<Student2> { private String name; private int