This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HAS-A Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HAS-A" Watch "HAS-A" New topic
Author

HAS-A

Tom Gustafsson
Greenhorn

Joined: Aug 10, 2008
Posts: 6
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?
nadav ben hadar
Greenhorn

Joined: Aug 10, 2008
Posts: 1
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
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HAS-A
 
Similar Threads
K & B doubt (SCJP 1.5)
is-a relationship confusion
has-a and static variables
Right view on questions
Has-a relationship