what are the rules to use try catch finally?



what are the rules to use try catch finally?..

Answer / 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

More Core Java Interview Questions

Can we have this () and super () together?

0 Answers  


Is alive in java?

0 Answers  


When abstract methods are used?

1 Answers  


How can we make sure main() is the last thread to finish in java program?

0 Answers  


What is a platform?

0 Answers  






What is the use of hashmap in java?

0 Answers  


Are there any tools available in java to create reports?

5 Answers  


Which list is sorted in java?

0 Answers  


What is tochararray in java?

0 Answers  


Can anonymous class have constructor?

0 Answers  


Why Wait and notify are kept in Object class although they are used only with Thread Class

2 Answers   Global Logic, Saksoft,


What are internal variables?

0 Answers  


Categories