Showing posts with label Exceptions. Show all posts
Showing posts with label Exceptions. Show all posts

Method Overriding with Exceptions in Java

March 17, 2015

Understanding method overriding with Exceptions has made some confusions in my mind. So I tried to list all the possible cases in terms of declarations of exceptions in super class method. The list of 3 main cases are as follows.

Case 1: Super class method declares NO exceptions

Here there are only 2 possible sub cases.
  1. Sub class method does not declare any Exceptions. This is the most obvious one since there are no Exceptions involved. So I'll omit the code sample.