I'm trying to compare the names of objects of my own class Person so I can sort an ArrayList. I followed what my teacher did but can't seem to get why it doesn't work.
import java.util.*;
public class SortName implements Comparable<Person>{
public int compare(Person p1, Person p2){
return p1.getName().compareTo(p2.getName());
}
}