Which of following method signatures would not be allowed in a class implementing the Printer interface?
class Exception1 extends Exception {} class Exception2 extends Exception1 {}? public interface Printer { abstract int printData() throws Exception1; }
printData()
throws Exception2 printData()
throws Exception printData()
B.
Overridden methods cannot throw new or broader checked exceptions than the one they inherit.
Since Exception is a broader checked exception than Exception1, Option B is not allowed and is the correct choice.
Alternatively, declaring narrower or the same checked exceptions or removing them entirely is allowed, making Options A and C incorrect.
Option B is correct
Option D is incorrect.