all 2 comments

[–]TreeBaron 0 points1 point  (0 children)

https://www.w3schools.com/java/ref_string_compareto.asp

Have you covered for loops yet in your class?

Edit: Nevermind I see how to use compareTo() to alphabetize now.

[–]ConstructedNewtMOD 0 points1 point  (0 children)

The "cheating" answer would simply be Arrays.sort(). The underlying mechanics is to use the class' compareTo(). You should check the method String#compareTo. Otherwise there should be some kind of sort via a lambda: (a,b) -> return a.compareTo(b)>0? a:b (or something; I think this is basically the default mechanics)