How jvm covers all scenarios to avoid not giving away stored value in reference variable
In java, a reference variable contains object reference which is some kind of wrapper over raw addr or pointer or some sort of mapping and during dereferencing this mapping is used to navigate to the object’s location in heap.