How to access a memory cell in Java?

Is it possible that we can directly or indirectly access a memory cell in Java?

If we try to print the object, it prints hashcode. Does hashcode indicate an indirect memory location?

For two objects in different memory locations, but still their hash code may vary.

-Abhishek

+3
source share
4 answers

Is it possible that we can access the memory location in Java directly or indirectly?

No.

+12
source

No, hashcode, in general, has nothing to do with memory location. The memory location of your object is the object reference itself.

, , . Java Object hashcode, javadoc, , Java. System#identityHashCode(Object) , - , hashCode() ( Object hashCode()). , . , , , . / , , ?

+7

, . , , , Java Native Interface, ++ C, .

, . - Java ,
+2

/ , - API. Sun/Oracle JRE sun.misc.Unsafe , , .

+2

Source: https://habr.com/ru/post/1743309/


All Articles