aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "K&B question" Watch "K&B question" New topic
Author

K&B question

Reghuram Variyam
Greenhorn

Joined: Oct 31, 2006
Posts: 17
This from new edition of K&B scjp 1.5. In chapter 2, the first question of self test is like this

Which Statements are true ?

A.Has-a relationship always rely on inheritance
B.Has-a rel. always rely on instance varables
C.Has-a rel. always require at least two classes
D.Has-a rel. always rely on polymorphism
E.Has-a rel. always tightly coupled.

The correct answer given in teh book is 'B'. But if a class has a Static reference to another object, that is also considered as Has-a rel. correct ?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
That's a good point, because in that case all instances of the class "have" the object referenced by the static (or class) reference variable.

Other opinions?


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Barry Gaunt:
...in that case all instances of the class "have" the object referenced by the static (or class) reference variable...

That's how I understand it.


"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
Reghuram Variyam
Greenhorn

Joined: Oct 31, 2006
Posts: 17
With the given options, it looks like there is no correct answer to that question ???
Suguna Gollapally
Ranch Hand

Joined: Oct 31, 2006
Posts: 37
ie Class (static) variable can also be used to define the Has-A relationship
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: K&B question