Example | |
|
Solution |
Always use the standard signature for compareTo methods - public int compareTo(ObjectType o).
Ensure that the ObjectType matches the type identified in the Comparable interface argument. |
public class ClassA implements Comparable<Integer> { public int compareTo (Integer i) { //... } } |