Page 1 of 1

About Question enthuware.ocpjp.v8.2.1319 :

Posted: Tue Sep 01, 2020 3:00 am
by YankeeDK
The question is: "An overriding method can declare ArithmeticException in its throws clause even if the overridden method does not have any throws clause" (true/false).

The answer is "Since ArithmeticException is a RuntimeException. Any method can throw it without declaring it in its throws clause.".

I feel like the answer is not related to the question. The question is about what you can put in a throws clause (relative to its super method), but the answer is not concerned with that. It simply says you can throw a runtime exception whenever.

Re: About Question enthuware.ocpjp.v8.2.1319 :

Posted: Tue Sep 01, 2020 5:52 am
by admin
The question is not a general question about throws cluase. It is very specific. It is about whether you can have ArithmeticExcpetion in a throws clause in an overriding method. The explanation correctly explains why that is ok.

Even so, we will enhance the explanation to make it better.

thank you for your feedback.