The equals
method of Object
just compare address:
public boolean equals(Object obj) {
return (this == obj);
}
I think it's not useful in most cases, and we may override it. But for the most Classes I developed, I didn't override the equals
method, because I won't use it at all...
So I just wonder, why Java language designer put equals
method in Object
?
Why there isn't an "Equalable" interface like Comparable
?