jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread" Watch "Thread" New topic


Steven Wong
Ranch Hand

Joined: Mar 07, 2002
Posts: 295
1. Is the wait and notify method called on the thread or on the object?
2. Is it also possible that a thread in the waiting state, never get executed even ater the notify method has called upon it?

best regards,<br />Steven<br />SCJP, SCEA
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
1. wait and notify are instance methods of the Object class so they are called on objects not on the class themselves. These methods are called on instances of type Thread.
2. first, you can't call notify on a specific Thread. It is possible that a Thread that had been waiting for a certain condition can get woken up but not executed becasue the condition still has not been met.

I agree. Here's the link: http://aspose.com/file-tools
subject: Thread
It's not a secret anymore!