Hi
Can we call finalize() method in Java?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AartiPosted Nov 17, 2011, 12:52 AM
Yes. Nobody will stop us to call any method , if it is accessible in our class. But a garbage collector cannot call an object's finalize method if that object is reachable.
Regards,
VulpesPosted Nov 9, 2011, 6:25 PM
It's usually best to leave it to the JVM to call the finalize() method just before the object is destroyed and its memory is recovered.