This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why this??

 
asp3000
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(), and notifyAll() methods must be executed in synchronized code.
C The notify() and notifyAll() methods can be used to signal and move waiting threads to ready-to-run state.
D The Thread class is an abstract class.
The answer is b c , but I think A is also correct!
 
Samith Nambiar
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the wait() method does make a thread in a Running state to become Not Runnable ... but note that the option says

The wait method defined in the Thread class

i guess the option is false because the wait() method is part of the class Object and only inherited in the Thread class
hope that helps
Samith.P.Nambiar
<pre>
\```/
(o o) harder u try luckier u get
-------oOO--(_)--OOo----------------------------
</pre>
 
asp3000
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Bin Wang
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why C is correct? I think it's wrong.
C The notify() and notifyAll() methods can be used to signal and move waiting threads to ready-to-run state.
notify() and notifyAll() methods can signal and move waiting threads to seeking lock state, but not ready-to-run state.
 
Haining Mu
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bin Wang:
notify() and notifyAll() methods can signal and move waiting threads to seeking lock state, but not ready-to-run state.[/B]

I think the words "can be used" is important, it didn't use "will signal and move..."
 
shailesh sonavadekar
Ranch Hand
Posts: 1874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
asp3000 , Welcome to javaranch.
PROPER NAMES ARE NOW REQUIRED
Please look carefully at official naming policy at javaranch & reregister yourself with proper first & last name. Please adhere to official naming policy & help maintain the decorum of the forum.
Waiting for your posts with proper first & last name. Once you have reregister , please let us know about that & then your previous account will be disabled.
Regards.

Your Friendly Bartender
Shailesh.
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!