This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Don't get me started about those stupid light bulbs.
 
subject: IS-A HAS-A Relationship
 
Similar Threads
OO Fundamentals
Compiling errata for K&B, SCJP 6
HAs-a Relationship Problem SCJPTEST
OO Design Pattern questions in SCJP 1.4 exam?
UML multiple inheritance - domain model