aspose file tools*
The moose likes Beginning Java and the fly likes Stop a thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Stop a thread" Watch "Stop a thread" New topic
Author

Stop a thread

Thomas Markl
Ranch Hand

Joined: Mar 08, 2001
Posts: 192
What wight cause the current thread to stop excutings?
A.thread of higher priority become ready
(yield-methode).
B.method sleep() be called.
C.method stop() be called
D.method suspend() be called.
E.method wait() be called
I think the answers are A, B, C, D, E.
Does a call to the wait method stop a thread?
Thanks for your answers.
Thomas.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Assuming "stop" in this question does not mean
that the thread cannot resume at a later time, then all options are correct, in my opinion.
If "stop" in this question means a final halt of the thread's execution, then only the (deprecated) method stop() will do it.
wait() is a method of Object.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
This question is testing your understanding of the thread life cycle and the different states that a thread can be in which are all described in The Life Cycle of a Thread Lesson of Sun's Java Tutorial on Threads.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Stop a thread