This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes threads - maha and khalid cross Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "threads - maha and khalid cross" Watch "threads - maha and khalid cross" New topic
Author

threads - maha and khalid cross

gayathri bhushan
Ranch Hand

Joined: Jan 29, 2001
Posts: 39
Which methods may cause a thread to stop executing?
1 sleep();
2 stop();
3 yield();
4 wait();
5 notify();
6 notifyAll()
7 synchronized()
Select all correct answers.
the correct answers are 1,2,3,4.
but in khalid it is given clearly as "calls to methods suspend(), sleep() and wait() do not stop a thread..they only cause the thread to move out of its running state. a thread will stop only when it is done executing the run method"
which one is right...please answer me
gayathri
lee dalais
Ranch Hand

Joined: Feb 28, 2001
Posts: 67
hi gayathri
i think that the answers are right, when a thread executes, it is in the running state, so it is in the run() method, those methods may cause the thread to stop executing, taking it out of the running state, meaning stopping it from executing the run() method.
'stop executing' doesn't mean thread is dead!
anyone pls correct where i'm wrong
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: threads - maha and khalid cross
 
Similar Threads
which one I should take it correctly
Which methods may cause a thread to stop executing?
Thread - various states of threa
Thread Question
Abt Threads