This question already has an answer here:
I am new to java and was wondering how to override an equals method. I was assigned 'Override the equals-method (from Object) so that it returns true for two objects that are logically equivalent based on the state of all of their instance variables.' I have no idea to go about this. I believe it starts with:
public boolean equals(Object object){
if (variableA = variable){
return true;
} else {
return false;
}
Aucun commentaire:
Enregistrer un commentaire