Try Block Raising Multiple Exceptions

Java Exception Multiple Catch Blocks

We know that a try block in Java will have a matching catch block. Now, we see how to use multiple catch blocks. Have a look at the picture.

The picture shows there are three code snippets within the try block. Let us assume code snippet 2 depends on code snippet 1 and code snippet 3 depends on code snippet 2. We will also assume each code snippet has the possibility of one exception type. From the picture, we can assume the exception types are A, B and C.