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 is the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "is the "implement" included in the "is a" relationship? " Watch "is the "implement" included in the "is a" relationship? " New topic

is the "implement" included in the "is a" relationship?

Simo Hayha

Joined: Jul 02, 2002
Posts: 19
wait for your answer
Valentin Crettaz
Gold Digger

Joined: Aug 26, 2001
Posts: 7610
When a class implements an interface, it agrees to fulfill the contract defined by that interface by implementing the methods declared within the interface. We can safely say that the implementing class augments its capabilities (behavior) when implementing (non-empty) interfaces. The class may then be known under different hats. For instance, if a class Test implements the interface Runnable, we can say that the class Test is_a Runnable because it provides the contract (the run() method) specified in the Runnable interface.

[Blog] [Blogroll] [My Reviews] My Linked In
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
From a practical perspective I think a class C implementing an interface i satisfy the is-a relationship. An instance of such class could be cast to i. It inherits the attributes from C. It conforms to the behaviour specified in i. Thus it can be treated as if were of type i: you can send it the same sequence of methods as you could send to an "instance" of the interface.
Maybe a OOAD expert could disagree from a theoretical view.

SCJP2. Please Indent your code using UBB Code
I agree. Here's the link:
subject: is the "implement" included in the "is a" relationship?
jQuery in Action, 3rd edition