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


Please Help Members By Posting Answers For Below Questions

What is the purpose of the main method?

777


Can a static method be overridden in java?

783


What are triggers in DB? Explain their types. How do they work?

891


When do we need to use internal iteration? When do we need to use external iteration?

874


how to one war file class to another war file class?

1813


How many types of java are there?

783


What is the use of isempty in java?

795


What is command line used for?

858


Can we have more than one package statement in the source file?

890


What are parsers? Dom vs sax parser.

813


Why are arrays useful in java?

816


How are the elements of a gridbaglayout organized?

822


What is a line break example?

790


Can a main method be overloaded?

802


who can i handle multiple client in RMI

1686