All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
Moderators: Site Manager, fjwalraven
- Posts: 1
- Joined: Mon Aug 31, 2020 9:59 am
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.
- Site Admin
- Posts: 9425
- Joined: Fri Sep 10, 2010 9:26 pm
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.
If you like our products and services, please help us by posting your review here
Users browsing this forum: No registered users and 2 guests