Parent-Child Exceptions Handling in Java

This “Parent-Child Exceptions Handling in Java” page is providing order of exceptions need to be placed in catch block in exception handling process in the hierarchy.

core-java-online-training-3

Try with Multi Catch Exceptions Rules:

  • While Handling more than one exception, we need to follow some rules.
  • We can handle more than one exception using try block.
  • In case of Parent-Child exception handling, we must handle Child exception first.
  • In Runtime binding, we cannot(no need to) address Child after addressing Parent.

 

We cannot handle same exception more than one time using one try block.

 

We can handle same level of exceptions(siblings) in any order.

 

We cannot handle Child exception followed by Parent.

core-java-online-training-3

Share this