I read on a site ( http://www.rajeshpatkar.com/articles/javarefpnt/ ) that when we instantiate a class i.e
Emp e = new Emp();
A handle is stored in the variable e, which is not a pointer i.e it does not store the address of object in memory.
The explanation gives an example of array of pointers. The memory address is stored at a[1] position and when the object is moved this position is updated with new address.
So why this array is used instead of directly storing the address (it states that it helps GC, but i didn't understand it ) and updating it (the address stored in e) when the object is moved?
I've spent quite a lot of time in understanding this, but still haven't found an answer that satisfies me. So if you can explain me what actually is stored in the variable 'e' (with an example) it would be quiet helpful.
Thanks :)