I am not getting the life cycle of garbage collector and will it call finalize() method internally?
Printable View
I am not getting the life cycle of garbage collector and will it call finalize() method internally?
There are various strategies employed by garbage collectors, but usually they check to see whether an object is accessible (has references to it) and, if not, they flag it as eligible for collection. When memory runs low, objects eligible for collection may have their finalize method called and their memory released for reuse.
There is no guarantee that an object's finalize method will ever be called, even if it becomes eligible for collection.
For details Google 'java garbage collection'.