Exception handling with method overriding in Java.

JavaJava Programming Java 8

Yes, we can override a method by changing only the exception handling in java pertaining the following rule −

An overriding method can throw any unchecked exceptions, regardless of whether the overridden method throws exceptions or not. However, the overriding method should not throw checked exceptions that are new or broader than the ones declared by the overridden method. The overriding method can throw narrower or fewer exceptions than the overridden method.

Published on 02-Feb-2018 15:21:37