This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "notify and notifyAll" Watch "notify and notifyAll" New topic

notify and notifyAll

Manali Rathi

Joined: Aug 01, 2000
Posts: 6
This is regarding question number 37 in the exam at site - Sample test 1 exam.
The question is :
Which of the following statements are true. Select all correct
(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
(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 !!!
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).]
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Can anybody please verify why a is not a right answer?
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

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......

[This message has been edited by Netla Reddy (edited September 03, 2000).]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: notify and notifyAll
jQuery in Action, 3rd edition