我想通过String对象调用Object hashCode方法。怎么做?

时间:2011-07-10 14:17:35

标签: java string object hashcode override

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 个答案:

答案 0 :(得分:12)

改为呼叫System.identityHashCode(s1)