Object.hashCode() algorithm

前端 未结 4 1171
醉梦人生
醉梦人生 2020-12-17 15:45

I\'m looking for the algorithm of Object.hashCode().

This code is native in Object.java.

Is this because

(a) the code is in assemb

4条回答
  •  萌比男神i
    2020-12-17 16:19

    It's because it relies on low-level details that aren't exposed to Java code. Some basic parts of the standard library (like java.lang.Object) must be implemented in native code.

    As an aside, you can find at least one interesting article that does into more detail about the HotSpot implementation.

提交回复
热议问题