This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I was wondering why 4 and 5 are the correct answers? Which two demonstrate a "has a" relationship? (Choose two.) 1. public interface Person{ } public class Employee extends Person{ } 2. public interface Shape{ } public interface Rectangle extends Shape{ }
3. public interface Colorable{ } public class Shape implements Colorable{ }
4. public class Species{ } public class Animal{private Species species;}
When determining if something is a "has a" relationship or an "is a" relationship look to see if it implements or extends a class or if it has a class or instance variable in the class. If it extends the class then you are saying that class A is a Class B. If you have an instance variable, then you are saying Class A has a Class B. So for the example above, answer 4 and 5 both have instance variables of another class, so you can say Animal has a Species called species and Container has a Component called children.
Michael Burke
Ranch Hand
Joined: Jul 29, 2000
Posts: 103
posted
0
Thanks for the answer, it seems clear now.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.