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 are use cases?
What methods are used to get and set the text label displayed by a button object?
What is thread life cycle?
Is main an identifier?
What are "class access modifiers" in Java?
Is java 9 released?
Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification
Do I need to import java.lang package any time? Why?
How do you use substring in java?
How to create packages in java?
What is meant by class loader? How many types are there?
How many types of classes are there in java?
Which types of exceptions are caught at compile time?
Explain spliterator in java8?
List primitive java types?