The equals method by default says "Is this the same object in memory?" unless you override it.
You didn't override it.
The behavior didn't change.
You'll want to add a new method like this
public boolean equals(Object o) {
if(o instanceof Dog) {
Dog d = (Dog)(o);
Dog t = this;
return t.height == d.height && t.weight == d.weight && t.name.equals(d.name);
}
return false;
}
Stephan brings up a good point - never, ever, ever implment equals without hashCode. Always use the same fields in both.
public int hashCode() {
int hash = name.hashCode();
hash = hash * 31 + weight;
hash = hash * 31 + height;
return hash;
}