What is the purpose of finalization?

Answer Posted / sandeep

While exception handling if exception is thrown programme
will abort abnormally but it can leads to some problamatic
situation..hence we have to ensure some code will always run
whtever happen..finalization does so. Some useful tasks that
we have to do ( cleaning up some resources or closing some
connection or socket etc) we can gurantee it will be done by
simply putting it in finally block.

It will run always (Unless System.exit() is not called) and
hence future problem can be handled.

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why java is used everywhere?

584


Have you ever used hashtable and dictionary?

568


Give few examples of final classes defined in Java API?

698


what is the difference between process and thread? : Java thread

557


Explain wrapper classes in java?

524






What are adapter classes?

597


What is the meaning of 3 dots in java?

678


What is the difference between class & structure?

559


What is the difference between jvm and jre? What is an interface?

544


What are anonymous inner classes?

560


What does string [] args mean?

536


What is parsing and its types?

579


What is preflight request?

522


What is tochararray in java?

494


What things should be kept in mind while creating your own exceptions in java?

621