manish ghildiyal wrote:In code snippet, compareTo is being called on name..it means that Class of which name is a type must be implementing Comparable interface.
I already said that. Please read the other responses before posting.
Infact, we can also make FancyThing implement comparable and then call its version of compareTo in compare method.
It's clear that the OP already knows that.