Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1135 :

Posted: Fri Sep 29, 2017 3:44 pm
by zoharch
"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 ?

Re: About Question enthuware.ocajp.i.v7.2.1135 :

Posted: Fri Sep 29, 2017 8:08 pm
by admin
Yes, define means the same as implement.

Re: About Question enthuware.ocajp.i.v7.2.1135 :

Posted: Tue Nov 13, 2018 6:18 pm
by myEtsUsername
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. Furthermore, the word "define" in this question could just as easily be understood to mean "declare":
Subclasses must declare all the abstract methods that the superclass declares.
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.

Thanks

Re: About Question enthuware.ocajp.i.v7.2.1135 :

Posted: Tue Nov 13, 2018 8:53 pm
by admin
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.
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.
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.

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.