Why we need Finally with try?
pls expain with ur example..
Answer Posted / neha
finally block gets executed in both scenarios I.e exception occurs or doesn't occur..it is used to write the code which we want to execute in both successful or failed scenarios..generally code for cleaning up resources added in finally block.e.g closing file,closing socket connection.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is meant by inheritance and what are its advantages?
What is prefix of a string?
Explain about arraylist?
Are primitives objects?
Tell me about different OOPS concepts.
How do you add an element to a hashset in java?
How many types of operators are there?
Is 0 true or false in java?
How to make a class or a bean serializable?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
What is the difference between serializable and externalizable interface?
What is currentthread()?
Is singleton set an interval?
What is the difference between throw and throws keywords?
what are the methods in object?