The moose likes Beginning Java and the fly likes IS-A and HAS-A  relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "IS-A and HAS-A  relationship" Watch "IS-A and HAS-A  relationship" New topic

IS-A and HAS-A relationship

sree visu
Ranch Hand

Joined: Jul 05, 2007
Posts: 133
(from k&b book from pg.94)

i suppose actually here they have used halter(in 1) like any basic variable declarationthis is also a derived declaration of type halter class.My doublt is that just by declarig "private halter myHalter;" weather an object is created .What is (LeadRope rope) (2).is LeadRope a class name or it is an object for class named "LeadRope).please do clarify my doubts.

Regards<br />Sree Visu<br />SCJP 5.0, SCWCD 5.0, SCJD(Preparing B&S 2.2.2)
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11914

no, no object is created until you see the word "new" somewhere (with a few exceptions).

the line "public void tie(LeadRope aRope)" is a method declaration. you are saying "give me a method that anyone can call (public), that doesn't return any value back to the caller (void), and name it "tie". the caller of the method must pass it a reference to LeadRope object, and within this method, that passed in reference will be called "aRope".

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
sree visu
Ranch Hand

Joined: Jul 05, 2007
Posts: 133
thankyou fred
I agree. Here's the link:
subject: IS-A and HAS-A relationship
It's not a secret anymore!