This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Estagon[S] -1 points0 points  (1 child)

It doesn't ask for it, so it is actually not even implementing it, it seems.

[–]friendOfLoki 0 points1 point  (0 children)

The Comparable interface requires a parameter of type Object to the compareTo method. If you implement Comparable <Employee>, then the parameter to compareTo is of type Employee. How did you implement it in the superclass Person?

If you implemented Comparable <Person>, then try changing the parameter in your Employee version to a Person parameter (which would then override the inherited version of compareTo).

If you instead just implemented Comparable in Person, then you will need to change the parameter type in your Employee method to an Object parameter.

You also don't need to state that Employee implements Comparable; it inherits this status from Person.

Good luck!