Multiple choice technology programming languages

What is the rule regarding overriding methods throwing exceptions?

  1. Overriding method can not throw more generic exception than base method

  2. Overriding method can throw new or broader checked exceptions

  3. None of the above

  4. Both a and b

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java, an overriding method in a subclass cannot throw broader or more generic checked exceptions than the overridden method in the superclass. Doing so violates the Liskov Substitution Principle and causes a compilation error.