Page 1 of 1

About Question enthuware.ocpjp.v7.2.1531 :

Posted: Fri Nov 09, 2012 7:42 pm
by ETS User
I disagree, because method throw NullPointerException which is a subclass of RuntimeException. So can not any Throws any RuntimeException

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

Posted: Fri Nov 09, 2012 8:03 pm
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.

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

Posted: Mon Apr 22, 2013 10:19 pm
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 ;)

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

Posted: Mon Sep 30, 2013 5:54 am
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.

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

Posted: Mon Sep 30, 2013 6:46 am
by admin
Yes, that is correct.

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

Posted: Sun Jan 08, 2017 3:30 am
by jagoneye
More importantly this question seems more appropriate to be of the Section Exception and Assertion rather than Overriding I think.