About Question enthuware.ocpjp.v8.2.1088 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
digitalillusion
Posts: 5
Joined: Wed Feb 25, 2015 4:11 pm
Contact:

About Question enthuware.ocpjp.v8.2.1088 :

Post by digitalillusion »

Hello,
I interpreted the question this way. It says: "aggregate features from multiple classes" so I immediately excluded inheritance, which is from a single class. While interface implementation, due to default and static method, is indeed aggregating features.
How would you argument the wrongness of my assumptions? Thank you.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by admin »

Your argument is valid but the question says from a "strictly OO perspective". In a strict OO sense, interfaces are not supposed to contain any implementation.
In the real exam, you should observe the wording of the question and decide whether it is asking about strict OO perspective or pure Java perspective.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

zhy2002
Posts: 1
Joined: Sun Jun 19, 2016 12:54 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by zhy2002 »

But you cannot inherit from multiple classes?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by admin »

That is correct. Java doesn't allow a class to extend from multiple classes. But this question is purely from an OO perspective.
If you like our products and services, please help us by posting your review here.

UncleF
Posts: 11
Joined: Wed Jun 14, 2017 3:43 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by UncleF »

So if the same question will be asked from Java perspective then
- Composition
and
- Interface implementation
will be correct answers?
Because I remember a similar question from OCA exam and there was citation from official Java documents about interfaces being the Java way of multiple inheritance.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by admin »

Yes, that is correct.
If you like our products and services, please help us by posting your review here.

thodoris.bais
Posts: 25
Joined: Sat Jun 03, 2017 4:56 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by thodoris.bais »

admin wrote:Your argument is valid but the question says from a "strictly OO perspective". In a strict OO sense, interfaces are not supposed to contain any implementation.
In the real exam, you should observe the wording of the question and decide whether it is asking about strict OO perspective or pure Java perspective.
HTH,
Paul.
Still this does not say anything to me about how the aggregation of features from multiple classes is related to the inheritance concept

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by admin »

When you extend a class, you do get features from that class, right? If you inherit from multiple classes (not possible in Java but possible in C++), you will get features from multiple classes in your class.

As mentioned in the text that you've quoted, "In a strict OO sense, interfaces are not supposed to contain any implementation." If there is no implementation then how will you aggregate features by implementing interfaces?
Static methods have nothing to do with OOP.
If you like our products and services, please help us by posting your review here.

thodoris.bais
Posts: 25
Joined: Sat Jun 03, 2017 4:56 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by thodoris.bais »

I think I get it now, the question probably implies "when used together" in the section about the code reuse techniques. So, the meaning is that composition together with inheritance can be used to aggregate features from multiple classes.

I thought the question meant "when used individually"

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1088 :

Post by admin »

No, not together with composition. Composition and inheritance are two different techniques and both, individually, do reuse code and aggregate features from multiple classes.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests