About Question enthuware.ocajp.i.v7.2.1064 :
Moderator: admin
About Question enthuware.ocajp.i.v7.2.1064 :
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.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1064 :
The statement is about the code shown at the top of the explanation and not about the code in the question.
I agree that different names for the classes in the explanation would avoid this confusion.
HTH,
Paul.
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.
Re: About Question enthuware.ocajp.i.v7.2.1064 :
Thank you ... I missed that when I was reviewing answers.
-
- Posts: 29
- Joined: Wed Apr 17, 2013 9:22 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1064 :
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.
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.
-
- Posts: 42
- Joined: Mon Jan 20, 2014 2:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1064 :
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???

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???

-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1064 :
That is not correct. Where did you read that?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???
Paul.
-
- Posts: 42
- Joined: Mon Jan 20, 2014 2:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1064 :
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.
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.

-
- Posts: 42
- Joined: Mon Jan 20, 2014 2:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1064 :
Well I probably was confused with calls to a constructor that can be only one class up...
Who is online
Users browsing this forum: No registered users and 6 guests