What is "finally" keyword?
Answers were Sorted based on User's Feedback
Answer / k.santosh kumar
Finally:
finally is block of code written in exception handling.
finally block is executed irrespective whether exception as
occured or not. it will usefull when u want to close user
defined resources like file , opened resources(db stmts).
Is This Answer Correct ? | 25 Yes | 2 No |
Answer / guest
FINALLY IS KEYWORD USED IN EXCEPTION HANDLING.
IT CREATES A BLOCK OF CODE TO BE EXECUTED AFTER TRY--CATCH
HAS COMPLETED AND BEFORE THE CODE FOLLOWING TRY--CATCH.
Is This Answer Correct ? | 11 Yes | 4 No |
Answer / taniya
The finally is Java keyword that is used to defined a block
that is always executed in a try-catch-finally statement.It
is use after the try an catch block to handle the unexpected
exception occurred in the try block.
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / piyush pathak
finally :
finally is a java keyword.It is a block of statement which
is executed surley after the try-catch block whether method
returns normally or throws an exception.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ss
The finally is Java keyword that is used to defined a block
that is always executed in a try-catch-finally statement.
try{
int x=10/2;
}
finally{
system.out.println("i am from finally");
}
here compiler will not compliant.why?even though x=10/2,x=10/0.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ravikiran(aptech mumbai)
finally is used to conserve the resources before the
exception is being caught
Is This Answer Correct ? | 4 Yes | 4 No |
Answer / seem a rana
final is the last class.that will never inherit further....
due to final key word... jus like ,,, final.test.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / pathan muzafar
Finally is a keyword which is used execute the blocks after try and catch blocks even if exception occured or not in both try and catch block.
Note: Here,Block means collection of statements(variables,methods etc)....
Exception means Run time error during execution
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sravanthi
In the finally block we usually have code that is used to
perform clean up activities corresponding to the code in the
try block.
Is This Answer Correct ? | 0 Yes | 0 No |
Wha is the output from system.out.println(“hello”+null); ?
What will happen inside init() in servlet. my interviewer asked servlet lifecycle. i said "once servlet is loaded in to memory init() will be called which performs servlet initialization " . Again interview asked what values will be initialized . what is difference between init() and init(ServletConfig config).
2 Answers Infinite Computer Solutions, TCS,
What is the longest unicode character?
what is synchronization and why is it important? : Java thread
what is difference between excute query ()and execute update ()?
whats is inheritance?
15 Answers CTS, HCL,
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?
What is private static in java?
What are voids?
What is jit compiler ?
why using interface interface ?
what is data binding? give the example