• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

OO Fundamentals  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Abid Khal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9613
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abid please QuoteYourSources when you post a mock exam question...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!