Page 1 of 1

About Question enthuware.ocpjp.v7.2.1527 :

Posted: Thu Jan 02, 2014 4:17 am
by jimi24
If we add abstract keyword in their class definition the class will become abstract and hence not defining body of method m1 is fine.

So Why option 2 and 3 are incorrect?

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

Posted: Thu Jan 02, 2014 4:33 am
by admin
Did you read the explanation for option 2? Same is the case with option 3.
You need to specify the keyword abstract if you don't have a body for the method.

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

Posted: Sat Jan 04, 2014 1:06 am
by jimi24
Yes, I read the explanation. But the question was "Which of the following classes can be made abstract just by adding the keyword abstract in their class declaration?"

And if we add abstract keyword in the class definition of code snippet of option 2 and 3 they will become abstract class and compile. Don't they satisfy criteria of the question?

The question didn't say they should be a valid compilable code before adding abstract keyword. They become valid compilable code after adding abstract keyword.

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

Posted: Sat Jan 04, 2014 1:22 am
by admin
For these options, you will need to add it to the method declarations as well. So they do not satisfy the requirement given in the problem statement because the question says, ".... in their class declaration" not "in their class definition".

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

Posted: Wed Jan 04, 2017 2:19 am
by jagoneye
Just a note:In a final class, only the methods are implicitly final but not
the declared fields.

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

Posted: Wed Oct 03, 2018 1:26 pm
by floryan
admin wrote:
Thu Jan 02, 2014 4:33 am
Did you read the explanation for option 2? Same is the case with option 3.
You need to specify the keyword abstract if you don't have a body for the method.
To be precise the question only asks how the classes can be made abstract and does not ask for them to compile. It would be good to specify that aspect too.

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

Posted: Sun Oct 14, 2018 1:48 pm
by jbilkes
i totally agree with the above comments on vague questioning....there is no mention to compile or not as is, without adding abstract, so why bother about that. Believe me, this is just plain wrong questioning. And don't tell me the word 'class' applies to compiling classes only haha

Apart from this i totally love this enthuware though ;)

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

Posted: Sun Oct 14, 2018 8:29 pm
by admin
Added the words, "without causing compilation failure" to make it clear.

thank you for your feedback!