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

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

Moderator: admin

Post Reply
ETS User

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

Post by ETS User »

Re: the note about aggregation and the statement that D is a member object in A. Class C creates an instance of D, not A. So I'm confused as to why it can be said that A 'has-a' D.

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

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

Post by admin »

The statement is about the code shown at the top of the explanation and not about the code in the question.

Code: Select all

Consider this code: 
class A extends B implements I
{
   D d = new D(); 
}

I agree that different names for the classes in the explanation would avoid this confusion.

HTH,
Paul.

ETS user

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

Post by ETS user »

Thank you ... I missed that when I was reviewing answers.

insider
Posts: 29
Joined: Wed Apr 17, 2013 9:22 am
Contact:

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

Post by insider »

Yes, it is needed to change class names for the code snippet in the explanation. I was the next to be confused.

I have another question. It is stated that "Aggregation defines a has-a relation.". However, Finegan/Liguori OCAJP study guide states that "direct association" stands for "has-a" and "aggregation association" stands for "is part of". Looks like they're kinda wrong.

Nisim123
Posts: 42
Joined: Mon Jan 20, 2014 2:26 pm
Contact:

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

Post by Nisim123 »

The question presents the following code:

interface X1{ }
interface X2{ }
class A { }
class B extends A implements X1{ }
class C extends B implements X2{
D d = new D();
}
class D { }

It is strange that one of the correct answers is:
C is-a A
While we all aware to the fact that inheritance works only for the 2nd generation, means only
for the class that extends it???
:roll:

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

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

Post by admin »

Nisim123 wrote: While we all aware to the fact that inheritance works only for the 2nd generation, means only
for the class that extends it???
:roll:
That is not correct. Where did you read that?
Paul.

Nisim123
Posts: 42
Joined: Mon Jan 20, 2014 2:26 pm
Contact:

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

Post by Nisim123 »

I think, but still not sure, that it was the explanation to one of the questions about inheritance
of Enthuware Test Studios,
or that i read it in the Kathy Sierra & Bert Bates guide in chapter 2, but if you say that it is not correct, then I will accept it as is. It might be that it is true only about the implemented interfaces or something I should certainly check that out.
yours,
nisim. :|

Nisim123
Posts: 42
Joined: Mon Jan 20, 2014 2:26 pm
Contact:

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

Post by Nisim123 »

Well I probably was confused with calls to a constructor that can be only one class up...

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests