Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are use cases?

1015


What methods are used to get and set the text label displayed by a button object?

1069


What is thread life cycle?

1030


Is main an identifier?

1058


What are "class access modifiers" in Java?

1208


Is java 9 released?

1065


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

1938


Do I need to import java.lang package any time? Why?

1456


How do you use substring in java?

1198


How to create packages in java?

994


What is meant by class loader? How many types are there?

1328


How many types of classes are there in java?

1115


Which types of exceptions are caught at compile time?

1081


Explain spliterator in java8?

1099


List primitive java types?

1096