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
What is the difference between a break statement and a continue statement?
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?
what is the volatile modifier for? : Java thread
Can we create an object of static class in java?
What is ‘is-a ‘ relationship in java?
What is the java reflection api? Why it’s so important to have?
Add a value x to array from index l to r where 0 <= l <= r <= n-1
How is garbage collection controlled?
Can we start a thread twice in java?
What is functional interface in java?
What is the use of protected in java?
What is the purpose of garbage collection in java? When is it used?
What is generic type?
What are the differences between include directive and include action?
Difference between class#getinstance() and new operator ?