Retrieve an object from memory using a hash code

My question is about the security level of the JVM

How can we get an object from memory by specifying a hash code?

Today I thought. I am creating a class A object in the One runtime. And get the hash code from here of this object.

Now in another runtime, I want to return a Class A object by providing a hash code.

I think it's possible. Because when I execute the environment alone. Again and again, I get the JVM to return the same hash code.

means that it first finds the object in the cache. If he receives the link, he will simply return it.


So, back to the question, we need to understand what data is copied when we write =.

  Object a=new Object();// here as we know reference of new object will be stored in refvar a.

Then what actually passes,

If we get what data is passed through = (equal operator). We can get the object from memory.

thank

+4
2

, -?

JVM. . , -. BTW: hashCode, .

, . . , JVM -.

, , hashCode , -.

, . , .

it , , JVM.

, , , =.

Object a=new Object();// here as we know reference of new object will be stored in refvar a.

, ,

, . .

+5

, , -

, JVM , , JVM, JVM, , .

+1

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


All Articles