如何通过String对象调用Object的hashCode方法?

9
public class Test {
    public static void main(String args[]) {


    String s1 = "abc";


        //Here is invoking of overriding String hashCode method.
        System.out.println("hashCode value  "+s1.hashCode()); }
}

我想要一个不会覆盖的Object hashCode方法,该怎么做?

1个回答

15

请使用 System.identityHashCode(s1) 代替。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接