Multiple catch block

Multiple catch block in java

If you have to perform different tasks at the occurrence of different Exceptions, use multiple catch block.

Example of multiple catch block


Rule:At a time only one Exception is occurred and at a time only one catch block is executed.

Rule:All catch blocks must be ordered from most specific to most general i.e. catch for Arithmetic Exception must come before catch for Exception .