为了账号安全,请及时绑定邮箱和手机立即绑定

求大神帮助,帮忙改一改,谢谢

求大神帮助,帮忙改一改,谢谢

慕粉2127281907 2017-03-21 21:37:16
package test; public class Student { public String name; int age; public Student(String name,int sex) { this.name=name; this.age=sex; } //public interface Comparator<T> class Student implements Comparator<Student>{ private String name; private int age; public Student(String name,int sex) { this.name=name; this.age=sex;} public int compareTo(Student a){ return this.age().compareTo(a.age()); } } public String toString() { return name+":"+age+"岁"; } 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=sex;} } } import java.util.Arrays; public class Test { public static void sort(short[] a, int fromIndex, int toIndex){ } public static void main(String[] args) { Student[] a = new Student[] { new Student("zhangsan", 20), new Student("lisi", 22), new Student("wangwu", 18) }; Arrays.sort(a);//要求学生按年龄从小到大进行排序 System.out.println(Arrays.toString(a)); } }
查看完整描述

2 回答

?
ziom

TA贡献948条经验 获得超1109个赞

代码格式化一下,这样一坨没法看

查看完整回答
2 反对 回复 2017-03-21
  • 慕粉2127281907
    慕粉2127281907
    写上去,有空格,分段很清楚,发表就成这样了,我也没办法。
  • 2 回答
  • 0 关注
  • 1201 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信