This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Similar Threads
Khalid mock exam question (pls help urgent)
MediaTracker and Sockets
MindQ question #41
some general Q's