File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HAS-A relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HAS-A relationship" Watch "HAS-A relationship" New topic

HAS-A relationship

Andy James
Ranch Hand

Joined: Aug 22, 2005
Posts: 90
Hi all,

Can classes and interfaces share HAS-A relationship? For the following code, is it correct to say that MyClass HAS-A MyInterface and MyInterface HAS-A MyClass?

Ankit Gareta
Ranch Hand

Joined: Mar 28, 2011
Posts: 67

Hi James,

I think , classes and interfaces share HAS-A relationship .
so that your mentioned scenario is perfectly true.

please, correct me if I am wrong somewhere.


OCPJP 6 (91%)
Don't get me started about those stupid light bulbs.
subject: HAS-A relationship
Similar Threads
Anonymous class behavior confusion !
Overriding rules... Please confirm!
Enthuware: relationship is-like-a
Difference between object and instance
Inheritance question - Interfaces