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 ?    25 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can a singleton class be inherited?

0 Answers  


what is stringtolennizer with example?

2 Answers   Symphony,


how to execute main()

4 Answers   Symphony, TCS,


How is java created?

0 Answers  


what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!

7 Answers   emc2, Kumaran Systems,






In what circumstances, compiler will supply a default constructor for a class?

4 Answers  


What does escaping a character mean?

0 Answers  


How many types of gc are there in java?

0 Answers  


Difference between static binding and dynamic binding?

0 Answers  


Is finalize() similar to a destructor?

0 Answers  


What is collection api?

0 Answers  


What is scope & storage allocation of global and extern variables? Explain with an example

0 Answers   IBS,


Categories