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
Can we clone singleton object?
Is main a keyword in java?
Explain the difference between call by refrence and call by value?
Is set thread safe java?
Where are variables stored?
Explain the difference between hashmap and hashtable in java?
What is autoboxing in java?
What is hashtable and explain features of hashtable?
What is dynamic array in java?
Does a class inherit the constructors of its superclass in java programming?
What is operator overloading. Is it is supported in java?
What are scriptlets?
Why does it take so much time to access an applet having swing components the first time?
Why set do not allow duplicates in java?
What is use of valueof () in java?