what are the rules to use try catch finally?

Answer Posted / naveen

Rules to using try catch finally blocks.

First thing is try,catch and finally blocks are used in
Exception Handling.In try block we are write Exception
rising code in catch block using exception handling code and
finally block is used to releasing the resource. try and
catch blocks are executed are not finally block is executed.
we are using this combination

try{
//Exception rising Code
}catch(Exception e){

}finally{
//releasing the resource
}

2)
try{
//Exception rising Code
}catch(Exception e){

}

3)try{
//Exception rising Code
}finally{
//releasing the resource
}

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is java volatile?

733


how to handle exceptions in ejb?

2089


What is ternary operator?

763


What is boolean flag in java?

792


Describe the term diamond problem.

767


What is bifunction in java?

877


Explain about main() method in java ?

796


How to make a class or a bean serializable?

729


Which is easier .net or java?

837


What is difference between next () and nextline () in java?

755


What is unicode used for?

814


What is a website container?

687


What is java in layman terms?

729


What is singleton class in ruby?

785


What's the purpose of static methods and static variables?

799