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 Posted / 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 |
Post New Answer View All Answers
In java, how many ways you can take input from the console?
Explain the private field modifier?
What is the difference between stream and buffer?
What is basic syntax?
What is thread start?
What is the primitive type short?
Garbage collection in java?
What happens if we don’t define serial version uid?
Is 0 a real number?
Why java is call by value?
What is the importance of hashcode() and equals() methods?
How to declare objects of a class ?
What is the use of optional ?
what happens when a thread cannot acquire a lock on an object? : Java thread
How does arraylist work in java?