This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object's Lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Object Watch "Object New topic
Author

Object's Lock

Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519


Are the notify() and wait() methods implemented correctly? I was expecting the output to be from 0 to 10 with no double nor numbers missing, but i am actually get doubles AND number missing...
[ July 07, 2005: Message edited by: Barry Gaunt ]

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD, SCEA/OCMJEA

Live life to an interface, not an implementation!
janki tangeda
Ranch Hand

Joined: Jun 07, 2005
Posts: 54
I have just started reading on java threads and i have a question on the code you wrote.Don't we use wait() method to wait for some condition to be met.I don't see any such condition here.For e.g. in getValue() method, is it not required to check if the value is updated and wait until the updating is done.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Object's Lock