• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HAS-A

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sierra & Bates Book for SCJP 5 training states that Has-a relationship always rely on instance variables.

With the book I got a CD with simulation of the exam + got one bonus exam for free.

In the bonus exam there was a question about Has-A relationship and "Has-a relationship always rely on instance variables." was one option which was not true. Explanation was that also classes static references are considered as HAS-A relationship.

That's confusing. What is the truth?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instance variables. and thats it....

some of the questions that you might find on the cd are also shown at the end of each chapter, such as this one which is question #1 on chapter 2.

the answer there is correct
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would say that static variables do constitute a HAS-A relationship.

Note that HAS-A is typically contrasted with IS-A. That is, composition vs. inheritance. Whether a field is associated with the class or with an instance, it's still composition.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic