we can get address of an object in memory. Well how? it is like that;
using sun.misc.Unsafe class in java.
create new Unsafe object and use the getAddress(Object)
; method and it will return a long value that is address.
and also there are many methods for this class.
you can change the values in this address using putInt(Object,long offset, int value)
or like this method.(getting some value getnt(Object)
).
Note: this class is really UNSAFE . if you make wrong things on your project, JVM will be stopped.