what is the purpose of the final in the try-catch-final
Answers were Sorted based on User's Feedback
Answer / vikas
final- declares a constant
finally- handles exceptions
finalize- helps in Garbage collection
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / srinivasa
Finally is a block where we can write the code to free up
the resources like File closing,socket obj closing .
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / ramakrishna challapalli
finally is an optional one its not a mandatory statement
after try-catch blocks
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / guest
finally will execute after catch block if try throw
exception else it will execute after try.
ex:
class a
{
public static void main(String []asd)
{
try
{
throw new Exception();
}catch(Exception e)
{
System.out.println("catch");
}
finally{
System.out.println("finally");
}
}
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / maha
That's not final,that one is finally, which is followed
after the try-catch block,It helps "garbage collection".
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / srinivas
After executing try catch statements last statement is
finally it must execute in at anycase
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / madhu
yes it correct it is finally,the use of finally is,if we
did not catch the exception in try/catch block also finnaly
will catch.
| Is This Answer Correct ? | 1 Yes | 6 No |
how many access specifiers are available in java
What is meant by class and object in java?
Why we can not force Garbage Collection?
Explain about class in java?
How do you sing an Applet ?
What is this keyword in java?
What is JAVA? Why it is platform independent?
How is string immutable in java?
What is the difference between throw and throws? What is the similarity between try and throw?
If goto and const is reserve words than why it is not work in java?
What are Access Specifiers and Access Modifiers.
How to compare two strings in java program?