跳到主要内容

我们可以在 hashcode() 中使用随机数字吗?

参考答案:

不行,因为对象的 hashcode 值必须是相同的。参见答案获取更多关于 Java 中重写 hashCode() 方法的知识。