Overriding method cannot throw any exceptions that are not thrown by the overridden method.
and your answer is False.
so you mean the overriding method can throw any exceptions that are not thrown by the overridden method.
This code is valid?
class A{
void m1() throws IOException{}
}
class B extends A{
void m1() throws Exception {}
}
Thanks!
About Question enthuware.ocpjp.v7.2.1128 :
Moderator: admin
-
- Posts: 15
- Joined: Tue Apr 21, 2015 1:36 am
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1128 :
No, if you want to get into the grammatical sense, the opposite of that statement would be, "Overriding method can throw some exceptions that are not thrown by the overridden method". The "some" would include subclasses of those exceptions and unchecked exceptions.
HTH,
Paul.
HTH,
Paul.
-
- Posts: 38
- Joined: Fri Nov 13, 2015 4:40 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1128 :
Well, an exception of a subclass is also an exception of the superclass, so that's not really true.The "some" would include subclasses of those exceptions
Agreed on unchecked exceptions.
Who is online
Users browsing this forum: No registered users and 5 guests