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
Is there a sort function in java?
How does varargs work in java?
How define set in java?
how to split string in java?
What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?
Can we override the static method?
Explain about features of local inner class?
Does list maintain insertion order java?
What is the size of integer?
Do we have pointers in java?
What are different types of constants?
What is a boolean flag in java?
Is main a function?
What does replaceall do in java?
Why array is used in java?