Hi friends
I want to know that can we have more than one try with single catch block in java. Please explain it with example.
Thank you.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted May 5, 2012, 6:27 AM
Consequently, you can't insert another try block before the catch block.
However, there's nothing to stop you nesting another try/catch statement within a try block. There's an example of this here:
http://www.roseindia.net/java/exceptions/nested-try.shtml
Satyapriya NayakPosted May 5, 2012, 5:48 AM
Please refer the below links
http://www.exampledepot.com/egs/Java%20Language/TryCatch.html
http://www.javamex.com/tutorials/exceptions/exceptions_try_catch_block.shtml
http://www.java-samples.com/showtutorial.php?tutorialid=293
Thanks