本文介绍了Java Object.hashCode()-地址还是random()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解hashCode()方法的本机实现.该方法究竟返回什么?是内存地址还是随机值?

I'm trying to understand the native implementation of the hashCode() method. What exactly does this method return? Is it a memory address or is it a random value?

推荐答案

.hashCode()本机实现取决于JVM.

.hashCode() native implementation depends on JVM.

例如HotSpot具有6个Object.hashCode()实现.您可以使用-XX:hashCode=n标志通过命令行运行JVM来选择它,其中n:

E.g. HotSpot has 6 Object.hashCode() implementations. You can choose it using -XX:hashCode=n flag running JVM via command line, where n:

这篇关于Java Object.hashCode()-地址还是random()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 05:14