This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Errata v2 - Updated errata for Kathy and Bert's book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Errata v2 - Updated errata for Kathy and Bert Watch "Errata v2 - Updated errata for Kathy and Bert New topic
Author

Errata v2 - Updated errata for Kathy and Bert's book

Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8803
    
    5
Anybody ever write a 711 page program?
We'd like everyone to know that we've just posted Version 2 of our errata page on www.wickedlysmart.com.
And...
In the next few days, we'll be announcing a new Java contest (did we say this a few days ago?) !!! More prizes, more fun !
Stay tuned !


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Ellen Zhao
Ranch Hand

Joined: Sep 17, 2002
Posts: 581
Page 533, Bottom code block 2/07/03

Change:

20. calculator.start();
21. new Reader(calculator).start();
22. new Reader(calculator).start();
23. new Reader(calculator).start();

To:

20. new Reader(calculator).start();
21. new Reader(calculator).start();
22. new Reader(calculator).start();
23. calculator.start();

Thank you very much for the errata, Bert! Here I have a question: The corrected code above worked find and I understand it. But why didn't the original code work well? I complied the both and the first one stuck after printed 3 lines of "waiting for calculation...". Why? Thank you.
Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
wow are you up to page 533 Ellen? just started on it myself, i am up to page 50. seems like a good book!


giddee up
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[b]The Ellen formerly known as Fu wrote:

And the Reader:

Thus, each Reader checks to see if the calculation has already been completed, immediately before executing a wait. And even if it receives a notifyAll(), it rechecks to see if the calculation really is done. The recheck may be unnecessary if you are certain that the only code that could possibly call notify/notifyAll is the code that is run when the calculator is done. However it's good to get in the habit of putting this check in a loop, as on more complex systems there may be other reasons notify is called, and it's hard to keep track of everything. See Joshua Bloch's Effective Java, "Item 50: Never invoke wait() outside a loop", for more info. This book is highly recommended for the other 56 items as well.
Of course, if the book example was not about a wait/notify protocol, you can just ignore this post.
[ February 15, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Ellen Zhao
Ranch Hand

Joined: Sep 17, 2002
Posts: 581
Jim,
Well spotted, exactly like what you said. Now the picture is clear to me. Thank you very much for your respond!
Ignore? Oh no...there's usually bonus for me to read your posts answering questions submitted by others which had nothing to do with my own work, there's not only simple fact but more...no way ignore
To Jasper,
No, several exams are dominating me concurrently now, I'm just like a CPU doing Round-Robin time slicing...have done with Chapter 9 and 1 of Kathy and Bert's book, planned to take this exam in late March.
Regards,
Ellen
Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
Originally posted by Ellen Zhao:
several exams are dominating me concurrently now, I'm just like a CPU doing Round-Robin time slicing...

well, that certainly implies that you are in touch with more than just your own personal inner-JVM ... in the sense that the issue of whether a system performs time-slicing is jvm-independent.
good luck with the tough german exams!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Errata v2 - Updated errata for Kathy and Bert's book
 
Similar Threads
Errata to errata of SCJP study guide by K. Sierra & BB
What is HFS
Developer Cert info available...
Collection (da Interface) question and possible errata item in K&B SCJP5
K&B error page 380