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 the importance of main method in Java?

811


Describe different states of a thread.

787


What is flush buffer?

760


When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?

1027


Can we override the static method?

783


What is casting in java programming?

786


What is api data?

782


What are the important features of Java 8 release?

817


What is the base class of all classes?

772


Is java free for commercial?

679


What is meant by data hiding in java?

875


What is java util list?

680


Why we use set in java?

782


What are predefined functions?

817


How many types of operators are there?

737