wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes OO Fundamentals 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 "OO Fundamentals" Watch "OO Fundamentals" New topic
Author

OO Fundamentals

Abid Khal
Greenhorn

Joined: Jan 05, 2009
Posts: 4
Hi,

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.

The answer is A) and B).

But, I would have thought it was B) and D). Any idea's why I'm wrong?

Regards,
Abid

Edit: Adding source - Question is from www.scjptest.com
Mark Moge
Ranch Hand

Joined: Mar 14, 2009
Posts: 96

You can write this code and there is HAS A relationship without instances. So D is incorrect
You may use instances to show IS A relationship


SCJP6 | http://programmerutilities.blogspot.com/
Abid Khal
Greenhorn

Joined: Jan 05, 2009
Posts: 4
Thanks Mark,

I missed the key words...

A) Instance variables can be used when creating a has-a relationship.
D) Instances must be used when creating a has-a relationship.

Makes perfect sense now.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Abid please QuoteYourSources when you post a mock exam question...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OO Fundamentals
 
Similar Threads
HAs-a Relationship Problem SCJPTEST
is a relationship
has-a relationship
Dan's Exam Q Doubt.
isn't interface support inheritance