Which method is required when you override a method that throws a checked exception?

  1. Must declare the same exception or subclass
  2. Must declare any exception
  3. Can declare nothing
  4. Can throw Error only
Correct answer Must declare the same exception or subclass

Explanation

When overriding, you can only throw the same checked exception or its subclass.

Update: Admin added a tag on this question

Topics

By Admin · · 45 views