This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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".