package cn.learn.collection.Collections; /* 排序的对象的类,实现comparable借口,重写compareto方法 若要打印必须重写toString方法,会默认调用 */ public class Person implements Comparable<Person>{ private String name; private int age; @Override public String toString() { return "P…
package com.test.jj; import java.util.ArrayList; import java.util.Collections; public class Test { ArrayList<Test.Men> mens = new ArrayList<Test.Men>(); public Test() { int[] ages = new int[] { 13, 54, 23, 45, 76, 22, 18, 69 }; for (int i = 0;…