Multiple catch block

// By:Team // No Comment

Email this to someonePrint this pageShare on Google+2Share on Facebook1Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon2

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 ArithmeticException must come before catch for Exception .


 

 

Email this to someonePrint this pageShare on Google+2Share on Facebook1Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon2

About Team

Browse Archived Articles by Team

Related

Sorry. There are no related articles at this time.