When is the finalize() method called in Java? -


i need know when finalize() method called in jvm. created test class writes file when finalize() method called overriding it. not executed. can tell me reason why not executing?

in general it's best not rely on finalize() cleaning etc.

according javadoc (which worth reading), is:

called garbage collector on object when garbage collection determines there no more references object.

as joachim pointed out, may never happen in life of program if object accessible.

also, garbage collector not guaranteed run @ specific time. in general, i'm trying finalize() not best method use in general unless there's specific need for.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -