"A problem well stated is a problem half solved.” - Charles F. Kettering
SCJP 6, OCPJWCD
is-a relationships always rely on polymorphism
Nidhi Sar wrote:When considering relationships between classes, which statement(s) are true?
A) is-a relationships always rely on inheritance
B) is-a relationships always rely on instance variables
C) is-a relationships always require atleast two class types
D) is-a relationships always rely on polymorphism
E) is-a relationships are always tightly coupled
The answers are A, C & D.
Santiago Ennis wrote:For example, C implements I i.e. C is-an I. Where is inheritance in this example?
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
As far as option C is concerned, that one seems wrong to me too as IS-A relationship can be between a class and an interface...
Ankit Garg wrote:
So you mean when a Class implements an Interface, there's no inheritance??
Santiago Ennis wrote:What about option C?
![]()
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
C) is-a relationships always require at least two class types
SCJP 5.0 100%
Inter is abstract; cannot be instantiated new Inter()
Interface is 100% abstract CLASS
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
SCJP 5.0 100%
SCJP 1.6 96%
SCJP 5.0 100%
rushikesh sawant wrote: polymorphism is obtained through inheritance.
SCJP 1.6 96%
SCJP 5.0 100%
Consider Paul's rocket mass heater. |