wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes has-a and static variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "has-a and static variables" Watch "has-a and static variables" New topic
Author

has-a and static variables

Joerg Waldmann
Greenhorn

Joined: Mar 14, 2006
Posts: 17
In the K&B Book is the answer of Self Test Questin 1 in Chapter 2:
Has-a relationships always rely on instance variables.

And what is about class (static) variables. Isn't that a has-a relationship, too?

Greetings
J�rg
sandeep biradar
Greenhorn

Joined: Mar 04, 2006
Posts: 4
please send correct question no.
Joerg Waldmann
Greenhorn

Joined: Mar 14, 2006
Posts: 17
It's in the SCJP 310-055, self test chapter 2, Question no 1.
The wright answer ist B, has-a relationship always rely on instance variables.

I think, has-a relationship rely on class variables, too.
Arno Reper
Ranch Hand

Joined: Mar 14, 2006
Posts: 286
The static var exists before an instance is made...what object does have them, then? You can't have a Has-a relationships with the static var.
Im still studying maybe Im wrong but I dont think so.
I hope you understand what I mean...


The man who makes no mistakes does not usually make anything<br /> <br />>>> SCJP 5.0 >> SCJD B&S <<< In progress
Joerg Waldmann
Greenhorn

Joined: Mar 14, 2006
Posts: 17
The definition of has-a in the book is: In Instance, that has a reference to the instance of another class.
So, in my opinion, a class variable is a reference to an instance, too. It's just the same instance for all objects of this class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: has-a and static variables