About Question enthuware.ocpjp.v7.2.1531 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ETS User

About Question enthuware.ocpjp.v7.2.1531 :

Post by ETS User »

I disagree, because method throw NullPointerException which is a subclass of RuntimeException. So can not any Throws any RuntimeException

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

Re: About Question enthuware.ocpjp.v7.2.1531 :

Post by admin »

I am not sure I understand your point but any method can throw any RuntimeException without declaring it in the throws clause.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

renatumb
Posts: 47
Joined: Mon Apr 08, 2013 7:55 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1531 :

Post by renatumb »

ETS User wrote:I disagree, because method throw NullPointerException which is a subclass of RuntimeException. So can not any Throws any RuntimeException
It can throw any "UNCHECKED EXCEPTION ", such as any RuntimeException or Error ;)

Wisevolk
Posts: 33
Joined: Thu Jul 18, 2013 6:06 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1531 :

Post by Wisevolk »

Hello,
just to refresh, in overriding return type MUST be the same (or covariant) and in overloading return type MIGHT be another type.
Can you confirm please.

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

Re: About Question enthuware.ocpjp.v7.2.1531 :

Post by admin »

Yes, that is correct.
If you like our products and services, please help us by posting your review here.

jagoneye
Posts: 97
Joined: Wed Dec 28, 2016 9:00 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1531 :

Post by jagoneye »

More importantly this question seems more appropriate to be of the Section Exception and Assertion rather than Overriding I think.

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests