This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I think there is an error in HFE on page 432. question 4. It gives correct answers as A and B. In my opinion B is wrong because the question states that relationship is unidirectional from Foo to Bar so the method call from b2.getFoo() is incorrect because it would mean that relationship is bidirectional. I checked with the spec (p. 138) and I think I am correct.
There is also a posibility that this is a editing error.
This particular question has several mispellings: 1. E. and D. in the none of the above (already reported in the errata) 2. Answer C in has b1.getBar() on page 426 and has b1.getFoo() on page 432 3. Possibly answer B is mispelled also. If we can change it to f2.getBar() it will be correct.
What do you all think?
SCBCD 1.3<br />SCJP 1.2<br /> <br />"Every time I learn something new, it pushes some old stuff out of my brain" H.Simpson
This question has been asked about a million times before ... but yeah, the questions got a boo-boo. Congrats for catching it. I don't have the question memorized, so I can't confirm your conclusion, but the fact that it's a unidirectional relationship is central to the error.