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

Can main() method in java can return any data?

653


How is it possible in java programming for two string objects with identical values not to be equal under the == operator?

569


hr interview how many minutes asking question

1571


How do you join strings in java?

532


When should I use singleton?

525






What is final access modifier in java?

596


Write a program to find maximum and minimum number in array?

555


What is an iterator java?

535


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

1737


Explain the scope or life time of class variables or static variables?

525


What is the difference between an interface and an abstract class?

544


What is a type parameter in java?

536


What is the difference between an if statement and a switch statement?

654


What is the difference between pass by reference and pass by pointer?

506


What is meant by binding in rmi?

556