File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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

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]
I agree. Here's the link:
subject: Stop a thread
jQuery in Action, 3rd edition