Answer Posted / 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 |
Post New Answer View All Answers
Can we compare two strings in java?
What is a dot notation?
What is scanner in java?
How do you implement singleton class?
Why is singleton class used?
What is collection class in java? List down its methods and interfaces.
What are the types of methodology?
Can we create an object of private class?
What does the append?
How can you generate random numbers in java?
Can one thread block the other thread?
What super () does in java?
Can a abstract class be defined without any abstract methods?
Explain the importance of finally over return statement?
Is singleton thread safe in java?