This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IS-A HAS-A Relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IS-A HAS-A Relationship" Watch "IS-A HAS-A Relationship" New topic
Author

IS-A HAS-A Relationship

Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 121

Question is from scjptest
What is true about has-a and is-a relationships? (Choose two)
A) Instance variables can be used when creating a has-a relationship.
B) Inheritance represents an is-a relationship.
C) Inheritance represents a has-a relationship.
D) Instances must be used when creating a has-a relationship.
Answers: A, B
The is-a relationship is expressed with inheritance and has-a relationship is expressed with composition.


I selected B and D, and D is wrong. Why?
What else other than an instance can be used for HAS-A relationship?


OCPJP 6 - 96%
Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 121

Found the answer:
http://www.coderanch.com/t/487816/java-programmer-SCJP/certification/OO-Fundamentals
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IS-A HAS-A Relationship