This can't be cleaned up.
aVoter is a Voter, and it is comparing to Voter. That is, you are comparing THIS voter to another voter, since this class is the Voter class. The only thing you can do to make it obvious (this is not a requirement in Java except when variable masking), is to add 'this.' in front of getAge to indicate that you are looking at this instance and comparing it to another instance.
You can tell as well that this is the case since the isOlderthan method is not declared as a static method. Static methods are tied to the class that defines it, and not to an object constructed from the class.
My personal preference is always to use this. when accessing objects. This is only because I do mainly PHP work where $this-> is required, unlike languages like Java an C# where they are optional (except when masked).
Now, as for a direct link to your question, there is no answer since your signature doesn't match the description of the signature:
Quote:
|
In the method isOlderThan() the message getAge() is sent to two different objects
|
Code:
public boolean isOlderThan(Voter aVoter)
The signature for isOlderThan accepts only one parameter, and not two.