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

What is the minimum and maximum length of an identifier?

6 Answers   TCS,


What is scanner in java?

0 Answers  


Java is based on pass by reference or pass by value ..

6 Answers   L&T, Wipro,


what is encapsulation in java? Explain

0 Answers  


I Have a class abstract with one abstract method, so that method should override in the subclass, but i dont want to override, if i am not override what will happen? If compilation will occur then i dont want to give compilation error, then what we need to do??? See the sample program. public abstract class AbstractExample { public abstract void sampleMethod(); } public class AbstractExampleImple extends AbstractExample { }

2 Answers   Mphasis,


What is compareto?

0 Answers  


How many bytes is 255 characters?

0 Answers  


What are features of java?

0 Answers  


Hey buddy.. can you please tell me about the use of marker interface? And is there any link between marker interface and factory methods? Thanks in advance.

2 Answers  


How can you write a loop indefinitely in java programming?

0 Answers  


how can you say that java is independ language

2 Answers   TCS, Wipro,


What is Locale class?

1 Answers   MySoft,


Categories