做完填空题再来做这个题。 下面的程序不完整,所以编译会出错。它对Student数组按学生身高排序,补上缺失的部分,贴出代码和执行结果。 TestAnonymous.java import java.util.Arrays; import java.util.Comparator; public class TestAnonymous { public static void main(String[] args) { Student[] students = new Student[] { new Student("zhang3", 175.5f), new Student("li4", 175.3f), new Student("wang5", 166), }; Arrays.sort(students); System.out.println(Arrays.toString(students)); } } class Student implements Comparable
{ String name; float heigth; public Student(String name, float heigth) { this.name = name; this.heigth = heigth; } @Override public String toString() { return "Student [name=" + name + ", heigth=" + heigth + "]"; } }