How to access memory location in Java?

后端 未结 4 1130
天涯浪人
天涯浪人 2021-01-14 18:32

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

If we tries to print a object, it will print hashcode. Does hashcode signify indire

4条回答
  •  借酒劲吻你
    2021-01-14 19:03

    Probably not for a primitive data type. You might be able to get addresses of data areas used for object storage on a reference type, though Java Native Interface, we can access the C++ or C and from that we can get the Memory location.

    It's sort of pointless, though. Because of garbage collection, any Java object can get moved in memory any time that any thread creates a new object

提交回复
热议问题