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

How to change the priority of thread or how to set priority of thread?

0 Answers  


what is the reason behind non static method cannot be referenced from a static Context?

2 Answers  


What is polymorphism and what are the types of it?

0 Answers  


What is java virtual machine? Explain

0 Answers  


What modifiers may be used with an inner class that is a member of an outer class in java programming?

0 Answers  






Why string is called as immutable?

0 Answers  


What is the driver class?

0 Answers  


What are the basic concepts of OOPS in java?

0 Answers   Axtria, ITC Indian Tobacco Company,


Can we pass a primitive type by reference in java? How

0 Answers  


Explain an algorithm to find depth of a binary tree.

0 Answers   Akamai Technologies,


Is there any need to import java.lang package?

13 Answers   Sun Microsystems,


What is palindrome in java?

0 Answers  


Categories