i can't understand these lines can anybody help me........
"In the finalize() method you could write code that passes a reference
to the object in question back to another object, effectively uneligiblizing the object
for garbage collection."
The finalize method is called before an object is garbage collected. An object is garbage collected when there are no more references to it.
So when the finalize method is called then there are no more references to the object. But if the finalize method introduces a reference (e.g.
by calling something like CentralRegister.register(this);) then the garbage collector will not garbage collect the object.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Joined: Apr 14, 2010
i dont know about CentralRegister.register(this);, can you please elaborate it, if possible provide me a code snippet which passes a reference
to the object in question back to another object........