try{
try{
}finally{}
3 try{
}catch(Exception e){
//lines of code to handle the exception thrown in try block
}
The catch blocks must always follow the try block. If there are more than one catch blocks they all must follow each other without any block in between. The finally block must follow the catch block if one is present or if the catch block is absent the finally block must follow the try block.
//lines of code that may throw an exception}catch(Exception e){
//lines of code to handle the exception thrown in try block}finally{
//the clean code which is executed always no matter the exception occurs or not.}
try{
}finally{}
3 try{
}catch(Exception e){
//lines of code to handle the exception thrown in try block
}
The catch blocks must always follow the try block. If there are more than one catch blocks they all must follow each other without any block in between. The finally block must follow the catch block if one is present or if the catch block is absent the finally block must follow the try block.
No comments:
Post a Comment