Here the answer is Good,Ugly,Bad. How is it sorted??? Can anyone explain the flow of the program.I am getting confused with the compare() method.
The purpose of the compare() method is to report the greater of two objects. With this method, an order can be established, and hence, the array can be sorted.
If you look at the compare method. It is reporting, the greater, based only on the second letter, and opposite of what the ASCII values are. Hence, the second letter is sorted in reverse order -- in this case, "o", "g", and "a".