JAVA RANCH QUESTION
It’s Wednesday, and I am taking the test on Friday.
But although I have learn many of the rules of Java, there are a few things I still don’t understand.
My question concerns the HAS-A concept, which is one of Sun’s exam objectives.
The expression HAS-A seem misleading since one object never contains another object. All objects live on the heap.
While class definitions can be nested, objects are never actually nested.
It seems to me that to own a reference to an object is just like having it’s phone number.
If object A has a reference to an object B, it can call it up and ask it questions, and give instructions.
And if A passes it’s own reference to B, B can call back, when it likes.
But B is never inside A , so why say that A HAS-A B?
The HAS-A concept seem to me to be misleading: or am I missing something?
Can any of you Cowboys advise ?
Regards
Dave