what is the purpose of the final in the try-catch-final
Answer Posted / 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 |
Post New Answer View All Answers
Can a main method be overloaded?
Where pragma is used?
Give me an example of array and linked list? Where they can be used?
How do you change an int to a string?
How do you sort arrays in java?
How many ways can an argument be passed to a subroutine and explain them?
What is java argument list?
In a container there are 5 components. I want to display the all the components names, how will you do that one?
Define inheritance with reference to java.
What is ‘is-a ‘ relationship in java?
What is the difference between stored procedure & function?
What is immutability in java?
What sorting algorithm does javascript use?
What will be the initial value of an object reference which is defined as an instance variable?
What is the use of a conditional inclusion statement in Java ?