File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark ""has a " relationship" Watch ""has a " relationship" New topic
Author

"has a " relationship

Sunitha Sounderrajan
Ranch Hand

Joined: Sep 12, 2000
Posts: 36
hi all,
I want to know how to determine whether a given relationship falls under "is a " or "has a " relationship.
I know when we use extends to extend from a class then it falls under "is a " relationship. i am confused with interface relations especially.
Sorry if it is too basic/beginner question. Can someone explain pls?
Thanks in advance.
Sunitha. S
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 2547
There are 3 of them:
is-a : When you extend. Ex: if class A extends B, then A is-a B.
has-a: When you contain something. Ex: If class A has a 'field' of class B, then A has-a B.
is-like-a : When you implement. Ex: if class A implements I, then A is-like-a I.
HTH,
Paul.

------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
zulfiqar raza
Ranch Hand

Joined: Oct 18, 2000
Posts: 81
Paul has already answered your question. Just like to add that
is-a relationship is Inheritance.
has-a relationship is Aggregation.
Zulfiqar.

[This message has been edited by zulfiqar raza (edited October 19, 2000).]
Sunitha Sounderrajan
Ranch Hand

Joined: Sep 12, 2000
Posts: 36
Thanks bunches Paul and Zulfiqar. Appreciate your prompt reply.
Sunitha. S
 
 
subject: "has a " relationship
 
Threads others viewed
Java Beginner / Java Intermediate clarification
Java Interview Questions
Local And Remote Mode
Amdocs - cyprus ... any views
Process, efficiency
IntelliJ Java IDE