can we call finalize()?
Printable View
can we call finalize()?
yes,we can and also you can use System.gc(); method
ofcourse we can call finalize method, and System.gc() is also made for requesting the garbage collection...although System.gc() do not guarantee the garbage coolection.
yes we can call the garbage collection methods, but there is no guarantee that objected marked for garbage collection will be infact garbage collected.
Ideally we should not do call or write logic based on garbage collection. It is the duty of the JVM to call this method.
[QUOTE=atnbhushan;26506]can we call finalize()?[/QUOTE]
Hi Friend,
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,
Rijus.
Yes you can call finalize(), but why you want to do something like this?
Share the problem statement, we might provide you a solution... if you may allow us.