aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object  Orientation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Object  Orientation" Watch "Object  Orientation" New topic
Author

Object Orientation

Ikechukwu Morah
Greenhorn

Joined: Nov 01, 2002
Posts: 18
What type of relationship is represented by the code snippets below:
A. public class Species {}
public class Animal {
private Species species;
}
B. interface Component {}
class Container implements Component {
private Component [] children;
}
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
The relationship between Animal and Species is a "has-a" relationship because Animal "has-a" Species.
The relationship between Container and Component is an "is-a" relationship because Container implements Component. A "has-a" relationship also exists because Container has a field that is an array of Container.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object Orientation
 
Similar Threads
How the fillowing maintains IS-A ralation
is a
Sun qstns - "has a" relationship
type of relationship - IS -A or HAS-A
is-a relationship