java Api provided try catch finally ,try catch(its ok) but why try finally and exception occured at try then how the flow is?
Answer / vandana singh
If you want to do a task that must be perform with every situation when exception occurs or not. that you should write the code for this in finally block. cause finally block execute in both situation exception occurs or not.
if an exception occurs then catch block statements execute after that control transfer to finally block.
if any exception not occurs than control transfer to finally block.
| Is This Answer Correct ? | 26 Yes | 0 No |
Can we override constructors?
How do listeners work?
What is the difference between throw and throws? What is the similarity between try and throw?
What is the need of "creating and throwing an UserdefinedException" when the "Exception" class is already available?
how to print a numbers from 1 to 100 with out using control structures?
Why operator overloading is not in Java?
What are use cases?
can any one tell me what is advantage of encapsulation
Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?
when i write string s1="java"; in one program(application) and string s2="java"; in another application on the same jvm will both objects s2,s2 will refer to same memory location where "java" is stored in string pool.
what is the difference between thread and runnable types? : Java thread
Is it possible to create Userdefined Unchecked Exception also?If Yes, give an example?