Hi! I saw that the code bellow, suggested by Guadalupe, solved the problem. But I didn't understand why and how this loops of arrays place the words in alphabetical order. Why the "greater" string is placed after, and the "smaller" is placed before? What does it have to do with the alphabet?
(I've already read the other help topics and about the compareTo() method and it's still not clear...)
Could somebody explain to me, please?
for (int i = 0; i < array.length; i++) {
for (int j = i + 1; j < array.length; j++) {
String temp = array[i];
String s1 = array[i];
String s2 = array[j];
if (isGreaterThan(s1, s2)) {
array[i] = array[j];
array[j] = temp;
}
}
}
Thanks!