I am writing a phonebook program in java and i need to list people in the list alphabetically and to do that i need to write a sorting algorithm for a list in java and it sh
Implement Comparable in your Person class.
Comparable
Your compareTo() method would then be something like:
public int compareTo(Person other) { return name.compareTo(other.getName()) }
Then use Collections.sort();
Collections.sort();