It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HAs-a Relationship Problem SCJPTEST Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HAs-a Relationship Problem SCJPTEST" Watch "HAs-a Relationship Problem SCJPTEST" New topic

HAs-a Relationship Problem SCJPTEST

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634
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

So,Instances are not required for Has -a relationship

can anyone give me a Example ?

OCPJP 6.0 93%
OCPJWCD 5.0 98%
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

A Ship has an Oar which is null. Oar does not necessarily have an instance associated with it

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15094

Where did you copy this question from? Please remember that you are required to QuoteYourSources on JavaRanch whenever you copy a question from a book, mock exam or other source.

What do you mean with "from SCJP TEST"? Is this from the real, actual exam? Are you aware that you are not allowed to copy the content of the real exam?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: HAs-a Relationship Problem SCJPTEST
It's not a secret anymore!