K & B page no 526
public boolean equals(Object o) {
if ((o instanceof Moof) && (((Moof)o).getMoofValue()
== this.moofValue)) {
return true;
} else {
return false;
}
//(Moof)o).getMoofValue() == this.moofValue))
K & B page no 535
public boolean equals(Object o) {
SaveMe
test = (SaveMe)o;
if (test.y == y && test.x == x) { // Legal, not correct
return true;
} else {
return false;
}
// if (test.y == y && test.x == x)
WHY NOT ( test.y == this.y)
K & B PAGE NO 563
public boolean equals(Object o) {
if((o instanceof Dog) &&
(((Dog)o).name == name)) {
return true;
} else {
return false;
}
// (Dog)o).name == name)
WHY NOT ( (Dog)o).name == this.name)