Multiple choice technology programming languages

The overriding method CAN throw any unchecked (runtime) exception.

  1. True

  2. False

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

Overriding methods in Java can throw any unchecked (runtime) exceptions regardless of what the overridden method declares. This includes RuntimeException, Error, and their subclasses. Checked exceptions are more restricted - overriding methods cannot throw broader checked exceptions than the overridden method.

AI explanation

When a subclass overrides a method, it is free to throw any unchecked (runtime) exception, regardless of what the overridden method in the superclass declares, because Java's overriding rules only restrict checked exceptions (an override can't add new or broader checked exceptions than the parent method declares). Unchecked exceptions aren't part of a method's checked contract, so no such restriction applies to them.