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 |
What do you understand by the bean persistent property?
What is double word?
What is the difference between stringbuffer and stringbuilder?
What are jee technologies?
why not override thread to make a runnable? : Java thread
84. try { 85. ResourceConnection con = resourceFactory.getConnection(); 86. Results r = con.query(”GET INFO FROM CUSTOMER”); 87. info = r.getData(); 88. con.close(); 89. } catch (ResourceException re) { 90. errorLog.write(re.getMessage()); 91. } 92. return info; Which is true if a ResourceException is thrown on line 86? 1 Line 92 will not execute. 2 The connection will not be retrieved in line 85. 3 The resource connection will not be closed on line 88. 4 The enclosing method will throw an exception to its caller.
Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.
What are java packages? What is the significance of packages?
Is null or empty java?
Why bytecode is called bytecode?
What is java literals?
what are abstract functions?