java Api provided try catch finally ,try catch(its ok) but why try finally and exception occured at try then how the flow is?



java Api provided try catch finally ,try catch(its ok) but why try finally and exception occured at ..

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

Post New Answer

More Core Java Interview Questions

What is singleton class?

16 Answers   3i Infotech, 7 Seas, ABC, Amdocs, Cap Gemini, Oracle, Persistent, TCS, Techforza,


all are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined classes and we can extend atmost one class so each class can extend more than one class so java supports multiple inheritance?i am confused with this,pls any one explain me.

8 Answers   CFG,


Can a static class have a constructor java?

0 Answers  


What is a string what operation can be performed out with the help of a string?

0 Answers  


How do you make a thread in java?

0 Answers  


What is data object example?

0 Answers  


Why we used vector class?

0 Answers  


Is void a wrapper class?

0 Answers  


How do you convert boolean to boolean?

0 Answers  


What are inner classes or non static nested classes in java?

0 Answers  


when we create singleton design then we create private constructtor..so how JVM take private constructor to make object..but it's private..

1 Answers   Ness Technologies,


What is the default modifier in Interface?

5 Answers  


Categories