package 对象比较排序; import java.util.Arrays; class A implements Comparable<A>{ private String name; private int age; public A(String name,int age){ this.name=name; this.age=age; } @Override public int compareTo(A o) {//此方法无需手工调用,Arrays会自动调用 if(this.age&…