About Question enthuware.ocpjp.v7.2.1531 :
Moderator: admin
About Question enthuware.ocpjp.v7.2.1531 :
I disagree, because method throw NullPointerException which is a subclass of RuntimeException. So can not any Throws any RuntimeException
-
- Site Admin
- Posts: 10061
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1531 :
I am not sure I understand your point but any method can throw any RuntimeException without declaring it in the throws clause.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 47
- Joined: Mon Apr 08, 2013 7:55 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1531 :
It can throw any "UNCHECKED EXCEPTION ", such as any RuntimeException or ErrorETS User wrote:I disagree, because method throw NullPointerException which is a subclass of RuntimeException. So can not any Throws any RuntimeException
-
- Posts: 33
- Joined: Thu Jul 18, 2013 6:06 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1531 :
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.
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.
-
- Site Admin
- Posts: 10061
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1531 :
Yes, that is correct.
If you like our products and services, please help us by posting your review here.
-
- Posts: 97
- Joined: Wed Dec 28, 2016 9:00 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1531 :
More importantly this question seems more appropriate to be of the Section Exception and Assertion rather than Overriding I think.
Who is online
Users browsing this forum: No registered users and 102 guests