aspose file tools*
The moose likes Beginning Java and the fly likes 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 » Java » Beginning Java
Bookmark ""is a" Vs "has a"" Watch ""is a" Vs "has a"" New topic
Author

"is a" Vs "has a"

Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
Please tell me about "is a " and "has a".
Thanks
Rikard Qvarforth
Ranch Hand

Joined: Jul 10, 2001
Posts: 107
Hello ..
well a cat "is a" animal .. ok ?
..in java that is = "class Cat extends Animal" a animal can be a cat ..
and a cat "has a" mjaiu call
.. in java that is
class cat extends animal{
private String soundCall = "mjaiu";
}
the "has a" is exclusive to the class .. but look at this
a person "is a" human .. class person extends human
a person "has a" head .. class person implements head
person nisse = new person();
so nisse "has a" head but a cat can also have a head..
class cat extends animal implements head
hope this helps ..
my english is sucks .. hummm



Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
Try reading this...
http://www.javaranch.com/campfire/StoryPoly.jsp
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986


my english is ****

I understood everything fine except for "mjaiu".


Please ignore post, I have no idea what I am talking about.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
"mjaiu" = "meow"


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Rikard Qvarforth
Ranch Hand

Joined: Jul 10, 2001
Posts: 107
he he well my cat at home is litle strange
Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
Thanks for all of your replies but, yet its not clear to me.
[This message has been edited by Sadaf Zaidi (edited November 25, 2001).]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10

Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
Thank you Marilyn deQueiroz .Its clear now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: "is a" Vs "has a"