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...


What is 'finally' method in Exceptions?

Answers were Sorted based on User's Feedback



What is 'finally' method in Exceptions?..

Answer / guest

this method will execute in any case whether an exeption
is aughat or not

Is This Answer Correct ?    3 Yes 0 No

What is 'finally' method in Exceptions?..

Answer / sumesh babu r

The finally method will be executed after a try or catch
execution.
It is mainly used to free up resources.
The codes that must be executed, irrespective of whether the
exception is occurred or not, will be included in the
finally block.

See the following simple example to demonstrate the syntax
public class FinallyExample
{

public static void main(String args[])
{

try
{
// the code that may cause an exception
}
catch (Exception e)
{
// the code to be executed, when the exception
occurs
}
finally
{
// code to be executed irrespective of the
occurrence of exception
}
}
}

When using finally, the catch block is not mandatory.
ie, a try block must be followed by a catch or finally block.

Is This Answer Correct ?    3 Yes 0 No

What is 'finally' method in Exceptions?..

Answer / ravikiran(aptech mumbai)

finally method is used to conserve the resources before the
exception is being caught

Is This Answer Correct ?    1 Yes 1 No

What is 'finally' method in Exceptions?..

Answer / k.k

ALL ANSWERS GIVEN ABOVE ARE WRITE.........


BUT

ONLY CASE THAT CAN SUPPRESS THE FINALY BLOCK IS

public class SupressFinallyExample
{

public static void main(String args[])
{

try
{
// the code that may cause an exception
//System.exit(0);
}
catch (Exception e)
{
System.exit(0);//if exception occure..
}
finally
{
// code to be executed irrespective of the
occurrence of exception
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Explain the importance of finally over return statement?

0 Answers  


What is the benefit of inner / nested classes ?

0 Answers  


If system.exit (0); is written at the end of the try block, will the finally block still execute?

0 Answers  


What do you understand by the term wrapper classes?

0 Answers  


What is a constructor, constructor overloading in java?

0 Answers  


What is immutable data?

0 Answers  


why an outer class cannot be declared as private?

1 Answers  


what is purpose of writting public static void main(Strind arg[]) in java..?

4 Answers   ITC Infotech,


What do heavy weight components mean in java programming?

0 Answers  


Explain the difference between runnable and callable interface in java?

0 Answers  


What is integers and example?

0 Answers  


Is null == null in java?

0 Answers  


Categories