Which of these method signatures is allowed in a class implementing the Outfielder interface?
class Exception1 extends Exception {} class Exception2 extends Exception1 {} ? public interface Outfielder { public void catchBall() throws Exception2; }
catchBall()
throws Exception2 catchBall()
throws Exception1 catchBall()
throws Exception D.
Trick question! Options A, B, and C are each invalid overrides of the method because the return type must be covariant with void.
For this reason, Option D is the correct answer.
If the return types were changed to be void, then Option A would be a valid override.
Options B and C would still be incorrect, since overridden methods cannot throw broader checked exceptions than the inherited method.