Comparable 和 Comparator2024-04-18 15:57:10public class NameComparator implements Comparator<Person> { @Override public int compare(Person p1, Person p2) { return p1.getName().compareTo(p2.getName()); } }上一篇:【网安小白成长之路】1.PHP基本语法下一篇:java:基于TCP协议的网络聊天室