r/programminghelp • • Dec 11 '20

Java New to Programming

I have a 4 length string array with 4 first names. I am trying to fill an empty string array with those 4 names but alphabetized. For this assignment I am supposed use compareTo() alphabetize them, but I don’t know how to then fill the empty array in order.

6 Upvotes

2 comments sorted by

View all comments

1

u/TreeBaron Dec 12 '20

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.