Nested try catch block.
We can have nested try catch blocks in which we have try block within a try blockI.
Few things to note are
- If an exception occurs in outer try i.e here control will go to outer catch and then to outer finally.
- If an exception occurs in inner try i.e here control will go to inner catch and then to inner finally.
- If inner catch cant handle it control goes to outer catch and then outer finally.
- If even outer catch cant handle an exception is thrown by the compiler at run time.
try{
try{
}
catch(Exception e){
}
finally(){
}
}//outer try ends
catch(Exception e){
}
finally(){
}