What is finally in exception handling?

Answers were Sorted based on User's Feedback



What is finally in exception handling?..

Answer / niranjanravi

finally is a keyword we have in Exception handling.It
creates a block of code to be executed after try or catch
has completed and before the code following the try or
catch.finally block will be executed whether or not an
exception is thrown.

Is This Answer Correct ?    18 Yes 1 No

What is finally in exception handling?..

Answer / mousumi

irrespective of whether a error occurs or not,the finally
block will be executed,either after the try block or after
the catch block or after boths are executed.

Is This Answer Correct ?    10 Yes 3 No

What is finally in exception handling?..

Answer / rizwana

The finally keyword can be used to provide a block of code
that is performed regardless of whether an exception is
signaled or not. The syntax is:
try
{
// tested statement(s);
}
catch (ExceptionName e1)
{
// trap handler statement(s);
}
catch (ExceptionName e2) // any number of catch statements
{
// display exception to screen
System.out.println("Exception: " + e2);
}
finally
{
// always executed block
}

Is This Answer Correct ?    6 Yes 1 No

What is finally in exception handling?..

Answer / manikandan adhimoolam

1.its a keyword in java
2.whether or not exception its automatically executed.
3.its follwed by try,catch.
4.its optional block.
5.using for connection close in db connection
6.if dont want execute finally u mention the catch block
system.exit(-1)

Is This Answer Correct ?    6 Yes 3 No

What is finally in exception handling?..

Answer / ravikiran(aptech mumbai)

finally is used to conserve the resources after the
exception is raised

Is This Answer Correct ?    1 Yes 1 No

What is finally in exception handling?..

Answer / vinoth kumar

In the event of exception handling no matter try block or
catch block is executed after that finally block will
executed.
Normally the finally block used for System.exit(),finalize
method,continue,break statement to direct program execution
after Exception handling.

Is This Answer Correct ?    1 Yes 1 No

What is finally in exception handling?..

Answer / valarmathi

finally is a specialized keyword used in exception handling.
finally is nothing which is given at the end of the
program. it is executed at the last. eventhough an
exception occurs after displaying all the exceptions this
finally block will be displayed. i.e, it is used to
terminate the program.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Core Java Interview Questions

what is difference betweem home interface and remote interface?

0 Answers   CTS, HCL,


Which class is the superclass for every class in java programming?

0 Answers  


whats is inheritance?

15 Answers   CTS, HCL,


how many ways to create Thread and which one is good? runnable interface ot Thread class?

3 Answers   Satyam,


How does thread synchronization occurs inside a monitor?

0 Answers  






This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }

0 Answers   HCL,


what is generics in jdk1.5?

2 Answers   Bally Technologies,


How variables are declared?

0 Answers  


Why do we need variables?

0 Answers  


Explain jvm, jre, and jdk?

0 Answers  


Why all programming languages have main as a execution starting point?

4 Answers  


what is class.forname() and how it will be useful ?

3 Answers  


Categories