Finalize() method will be called only once just before the garbage collector runs for that object. If you avoid the garbage collector to run on that object by holding the refernce to that object in finalize() method, then the garbage collector will not run for that object. Later even if the object becomes eligible for garbage collection, the finalize() method for that object will not run.
Correct, however often the object comes before the garbage collector finalization will happen only the first time (which means that effectively an object can probably not come before the garbage collector more than twice unless there's something weird happening in the garbage collector and thus in the JVM internals, situations outside the scope of the SCJP exam as they'd be JVM implementation specific and most likely bugs.
42
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth