File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes notify and notifyAll 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 "notify and notifyAll" Watch "notify and notifyAll" New topic
Author

notify and notifyAll

Manali Rathi
Greenhorn

Joined: Aug 01, 2000
Posts: 6
This is regarding question number 37 in the exam at site http://www.javaprepare.com/quests/test.html
javaprepare.com - Sample test 1 exam.
The question is :
Which of the following statements are true. Select all correct
answers.
(a)The wait method defined in the Thread class, can be used to convert
a thread from Running state to Waiting state.
(b) The wait(), notify(), notifyAll() must be executed in sybchronized
code.
(c) The notify() method can be used to signal and move waiting threads
to ready-to-run state.
(d) The Thread class is an abstract class.
Answer at site to this question is b,c . But I have a doubt here.
The notify method can be used to signal and move only one(any one out
of many if there are many) waiting thread not threads to ready-to-run
state. notifyAll() is used to signal and move waiting threads to
ready-to-run state. Please clarify !!!
rajsim
Ranch Hand

Joined: May 31, 2000
Posts: 116
There are many more errors in the site mentioned by you. Watch out.
[This message has been edited by rajsim (edited August 07, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Can anybody please verify why a is not a right answer?
Thanx
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Why a is not right. Is it bcoz when wait() is applied to a running thread, it goes to ready state not waiting state. Please clarify.
Netla Reddy
Greenhorn

Joined: Jun 18, 2000
Posts: 15
Dear All,
wait() method is not implimented in the in the thread class, It should implement in the in object class.
notify() will move only one thread form waiting to ready and notifyall () will move all waiting threads to Ready state
I hope it is clear......
Thanks

[This message has been edited by Netla Reddy (edited September 03, 2000).]
 
Consider Paul's rocket mass heater.
 
subject: notify and notifyAll