"Subclasses must define all the abstract methods that the superclass defines."
"A class implementing an interface must define all the methods of that interface."
What does it mean "define".
They should implement all the abstract methods isn't it ?
About Question enthuware.ocajp.i.v7.2.1135 :
Moderator: admin
-
- Posts: 4
- Joined: Fri Sep 29, 2017 3:34 pm
- Contact:
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1135 :
Yes, define means the same as implement.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Sun Sep 30, 2018 12:03 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1135 :
I feel this question is written ambiguously.
Admin says "define means the same as implement".
If that's true, and we replace all instances of the word 'define' with 'implement' it turns the first answer from this:
Thanks
Admin says "define means the same as implement".
If that's true, and we replace all instances of the word 'define' with 'implement' it turns the first answer from this:
into this:Subclasses must define all the abstract methods that the superclass defines.
which is meaningless since abstract methods are by definition not implemented. Furthermore, the word "define" in this question could just as easily be understood to mean "declare":Subclasses must implement all the abstract methods that the superclass implements.
This awkward phrasing, but seems as plausible as any alternative. In any case, the confusion stems from the word "define" being used to mean two different things in the same sentence.Subclasses must declare all the abstract methods that the superclass declares.
Thanks
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1135 :
The question and the explanation are fine. There is a difference between declaration and definition with respect to methods in Java. And definition does mean the same as implementation in this case.
Further, an incorrect option doesn't have to make sense. It could be completely meaningless also. Although that is not the case here.
Irrespective of how you read this option, it is unambiguously an incorrect option.
It is actually a wrong option but not really completely meaningless. A language could force a subclass to implement all abstract methods of the superclass. Java does not impose such rule. Java does not require a subclass to implement abstract methods of it superclass but in that case it requires the subclass to be declared as abstract. That is what the explanation also says.I feel this question is written ambiguously.
Admin says "define means the same as implement".
If that's true, and we replace all instances of the word 'define' with 'implement' it turns the first answer from this:
Subclasses must define all the abstract methods that the superclass defines.
into this:
Subclasses must implement all the abstract methods that the superclass implements.
which is meaningless since abstract methods are by definition not implemented.
Further, an incorrect option doesn't have to make sense. It could be completely meaningless also. Although that is not the case here.
Irrespective of how you read this option, it is unambiguously an incorrect option.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 84 guests