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 is the difference between final, finally and finalize() in java?

1052


How do you delete a list in java?

903


What is the importance of main method in Java?

1015


Explain the polymorphism principle?

959


What is parsing and its types?

1021


Implementations of set interface?

941


How big is a boolean?

981


What are the different approaches to implement a function to generate a random number?

996


Can we overload destructor in java?

927


Differentiate between nested and inner class in java.

951


What is java lang object?

921


What is a variable declaration?

926


What is the purpose of garbage collection in java? When is it used?

997


Is finalize() similar to a destructor?

968


Discuss about garbage collector in Java.

1028