When is the finalize() method called in Java?

In general it’s best not to rely on finalize() to do any cleaning up etc. According to the Javadoc (which it would be worth reading), it is: Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. As Joachim pointed out, this may never happen in the life … Read more