import java.util.Comparator; public class PersonComparator implements Comparator { public int compare(Person p1, Person p2) { // a silly sort criterion: sort by the second letter of a person's name // (and not very robust; what if a person's name is just a single letter?) // students: think about why the below works; // consider the alternative using < and == // remember that characters (not strings) and numbers are "the same" in Java // hint: https://www.asciitable.com/ return p1.name.charAt(1) - p2.name.charAt(1); } }