Before discussing about 4 rules to handle exception in overriding method. You should understand concepts of
Exception handling in override method these are 4 rules where you have to handle exceptions for child class according to given parent class scenarios:

Note : When you face any Java interview and test at least one or two questions surely will ask based on these cases to check you Exception Handling concepts and practical knowledge.
Case 1 : If parent-class method doesn’t declare any exception
- Child class overriding method can declare no exception in overriding method.
Overriding Method No Exception throws - Child class overriding method can declare unchecked exception in overriding method.
Overriding Method Throws Unchecked Exception - Child class overriding method can declare strictly no checked exception in overriding method.
Override method throws no checked exception
Case 2 : If parent-class method declares unchecked exception
- Child class overriding method can declare no exception in overriding method.
Parent Class Unchecked Exception Child Class No Exception - Child class overriding method can declare any number of unchecked exception in overriding method.
Parent Class method UncheckedException and Child Class overriding method unlimited Unchecked Exception - Child class overriding method can declare strictly no checked exception in overriding method.
Parent Class Unchecked Exception and Child class overriding method Checked Exception not allow.
Case 3 : If parent-class method declares checked exception
- Child class overriding method can declare no exception in overriding method.
Parent Class Method Checked Exception Child Class Overriding Method No Exception - Child class overriding method can declare same checked exception in overriding method.
Parent Class method Checked Exception Child Class overriding method same Checked Exception - Child class overriding method can declare sub-type of checked exception in overriding method.
- Child class overriding method can declare any number of unchecked exception in overriding method.
Case 4 : If parent-class method declares both checked & unchecked exceptions
- Child class overriding method can declare no exception in overriding method.
Parent class checked and un-cheked exception child class overriding method no exception - Child class overriding method can declare same checked exception in overriding method.
Parent class having checked and uncheck exception both and child class overriding method having same checked exception - Child class overriding method can declare sub-type of checked exception in overriding method.
Parent class having checked and uncheked exception child class overriding method having sub class of checked exception - Child class overriding method can declare any number of unchecked exception in overriding method.
Parent class having chceked and unchecked exception and child class overriding method having unlimited unchecked exception
Conclusions
I have covered all scenarios for exception handling in overriding method:
- If parent-class method doesn’t declare any exception, then child-class overriding-method can declare,
- 1. No exception or
- 2. Any number of unchecked exception
- 3. but strictly no checked exception
- If parent-class method declare unchecked exception, then child-class overriding-method can declare,
- 1. No exception or
- 2. Any number of unchecked exception
- 3. but strictly no checked exception
- If parent-class method declare checked exception, then child-class overriding-method can declare,
- 1. No exception or
- 2. Same checked exception or
- 3. Sub-type of checked exception or
- 4. any number of unchecked exception
- All above conclusion hold true, even if combination of both checked & unchecked exception is declared in parent-class’ method
Know More
To know more about Java Exception Hierarchy, in-built exception , checked exception, unchecked exceptions and solutions. You can learn about Exception Handling in override methods and lots more. You can follow below links: s
You must log in to post a comment.