//1.定义一个学生类student,具有年龄age和姓名username两个属性,并通过Comparable接口提供比较规则; public class student implements Comparable<student>{
private string username; private int age;
public string getUsername(){
return username;}
public void setusername(string username){
this.username = username;
public int getAge() {
return age;
public void setAge(int age){
this.age = age;
}
@Override
public string tostring(){
return "student{" +
"username='" + username + '\'’ ', age=" + age +'}';
}
@Override
public int complreto(student o) {
return 0;
}