说明
- public static int identityHashCode(Object x):返回与默认方法 hashCode()返回的相同的哈希码,无论给定对象的类是否重写了 hashCode()。对于 null 引用,哈希码为零。
示例
public class Test {
public static void main(String[] args) {
String s1 = "hello";
System.out.print(System.identityHashCode(s1));
}
}
运行结果:
