About Question enthuware.ocajp.i.v8.2.945 :

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

Post Reply
goncaloncpinto
Posts: 5
Joined: Mon Feb 15, 2016 5:43 am
Contact:

About Question enthuware.ocajp.i.v8.2.945 :

Post by goncaloncpinto » Wed Feb 24, 2016 6:07 am

On this statement:

An overriding method cannot exhibit behavior that contradicts the declaration of the original method. An overriding method therefore cannot return a different type (except a subtype) or throw a wider spectrum of exceptions than the original method in the superclass.

I think the part in red is wrong, you can throw any unchecked exception or error (not a good practice though) from the overriding method.

Am I right?

admin
Site Admin
Posts: 8621
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.945 :

Post by admin » Wed Feb 24, 2016 7:13 pm

Unchecked exceptions i.e. RuntimeExceptions and Errors are not required to be declared at all. So, yes, they can be thrown by any method anytime but that is not really relevant here.

We will add this point to the explanation to make it clear.
Thank you for your feedback.
Paul.
If you like our products and services, please help us by posting your review here.

goncaloncpinto
Posts: 5
Joined: Mon Feb 15, 2016 5:43 am
Contact:

Re: About Question enthuware.ocajp.i.v8.2.945 :

Post by goncaloncpinto » Thu Feb 25, 2016 9:17 am

I was not very clear on my comment too. The text in red is not wrong, i wanted to say it can be better making it more clear. :)

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests