elibraryportal Logo

Multiple catch block in Java

→ In Java provide to use of multiple catch-block with single try-block.

→ If you perform on different task at occur on different task.

→ At a time only one Exception is occur at a time, only one catch block is executed.

Example1

Output:-

Multiple Catch Exception Example

Example2

Output:-

Multiple Catch Exception Example