Would there be any value using a try catch statement inside another try block?
try{
// some code...
try{
// some code...
}catch(Exception ex){
ex.printStackTrace();
}
// some code...
}catch(Exception ex){
ex.printStackTrace();
}
Yes. You might want to catch a very specific exception in the inner block, which you could handle and return to the remainder of the block...
You would normally only do this with more specific Exceptions in the inner block though, rather than the catchall.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With