Which of the following exception types must be handled or declared by the method in which they are thrown?
B.
NullPointerException and ArithmeticException both extend RuntimeException, which are unchecked exceptions and not required to be handled or declared in the method in which they are thrown.
On the other hand, Exception is a checked exception and must be handled or declared by the method in which it is thrown. Therefore,
Option B is the correct answer.