posted 13 years ago
Im struggling to understand why these two statements are generating a compiler error
The code used is shown below
And the instances are initialised as follows
The error being generated is shown below
- Error 1 is complaining about the cities object. The Cities class implements Comparable so why is it not allowing it
- The second error is complaining about cities2. This is based on the CitiesNoComparable class. This class does not implement comparable so this error is probably justified.
- The third error is based on the same object but i am passing a Comparator in the search. Shouldnt this have been accepted?
Thanks