Why equals and hashCode were defined in Object?

前端 未结 10 1178
天命终不由人
天命终不由人 2020-12-06 05:50

What\'s the reasoning behind decision to include these methods in the java.lang.Object? Equality and hashing doesn\'t make sense for many classes.

It would be more l

10条回答
  •  有刺的猬
    2020-12-06 06:06

    Mhh not sure but when Java 1.0 was released generics did not exist yet. They were added in Java 5.0 in 2004.. so your proposal could not be implemented for Java 1.0

提交回复
热议问题