还是java牛逼,一行代码搞定各种排序
排序大家都经常用的吧,下面是个学生类,2 个字段:id[学号],score[分数],
public class Stu { //编号 private Integer id; //分数 private Integer score; public Stu(Integer id, Integer score) { this.id = id; this.score = score; } // getter、setter大家自己补上 @Override public String toString() { return "Stu{" + "id=" + id + ", score=" + score + ‘}‘; } }