Nested try block in java

In the previous post, we have seen try-catch block. In this post, we will discuss about the nested try block in java.

A try block placed inside another try block is known as Nested try block.

Suppose, a part of try block causes different error from the whole try block. In that case, we can use nested try block.

Syntax of Nested try block:

Example of nested try :

Start a nested try
Error : variable is null
data further divided after nested try block : 5
Important steps to be executed
Ask Question
If you have any question, you can go to menu ‘Features -> Q&A forum-> Ask Question’.Select the desired category and post your question.
try and catch block in java
Multiple catch block in java
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

1 Response

  1. August 9, 2015

    […] the previous post, we have seen Nested try blocks. In this post, we will see if it is possible to have multiple catch block or […]