我有一个对象 Mutation,我已经对其进行了“新建”。但是当它用 toString() 打印出来时,对象说 Mutation@0。这对我来说似乎不太好。这可能意味着什么?
最佳答案
也就是无符号十六进制表示
As per Docs of toString() method in Object class
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
零
在哈希码尚未计算的意义上。
public String toString() {
237 return getClass().getName() + "@" + Integer.toHexString(hashCode());
238 }
关于java - 对象的jvm地址为0是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18592891/