调试时,对象实例表示"result = {SomeClass@816}"是什么意思?

When debugging, what does the object instance representation "result = {SomeClass@816}" mean?

我正在调试我的 java 程序,我有一些 class 的实例 "instance1" 称为 "SomeClass"。当我评估变量 "instance1" 时,它说结果 = {SomeClass@816}.

“@816”到底是什么意思?

我知道不是hashCode(),是实例内存地址吗? 如果是这样,我如何 "see" 代码中的实例地址?调用对象本身的哪个方法?

注意:我使用的是 IntelliJ Idea

public class SomeClass {

private String name;
private int id;

@Override
public String toString() {
    return this.name + this.id;
}

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    String objName =  ((SomeClass) o).name;
    return this.name.equals(objName);
}

@Override
public int hashCode() {
    return this.name.hashCode();
}

816 属于每个 java 对象的 identityHashCode(方法 System.identityHashCode())。

你的Class覆盖hashcode()方法无关紧要,因为identityHashCode() 将调用 您的对象 .

的自然 hashcode() 方法

来自docs

Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode()