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

Why array is used in java?

720


What is another word for methodology?

768


Is string a wrapper class?

756


Write a program to print 15 random numbers using foreach of java 8?

751


How do you create a bulleted list?

835


Difference between static and dynamic class loading.

805


What is tochararray in java?

709


This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }

766


Why for each loop is used?

760


Why generics are used in java?

784


Why singleton class is used in java?

822


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

835


How to reverse a string in java?

779


Which method must be implemented by all threads?

979


Differentiate between static and non-static methods in java.

811