/ Published in: Java
Strings are sorted in ascending order.
This was created by me in order to thwart Dr. McCloskey's evil ways of forcing CS majors to manually alphabetize lists of names and months.
This was created by me in order to thwart Dr. McCloskey's evil ways of forcing CS majors to manually alphabetize lists of names and months.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import java.util.*; public class SortName{ int i = 0; while(i < num){ names[i] = s.nextLine(); i++; } StringComparator strcomp = new StringComparator(); } } } class StringComparator implements Comparator<String>{ return a.compareTo(b); } }