Java Programming - Threads - Discussion

Discussion Forum : Threads - General Questions (Q.No. 15)
15.
Under which conditions will a currently executing thread stop?
  1. When an interrupted exception occurs.
  2. When a thread of higher priority is ready (becomes runnable).
  3. When the thread creates a new thread.
  4. When the stop() method is called.
1 and 3
2 and 4
1 and 4
2 and 3
Answer: Option
Explanation:
The statements (2) and (4) makes currently executing thread to stop.
Discussion:
6 comments Page 1 of 1.

Groumpf said:   10 years ago
What "a currently executing thread stop" means?

For me, when no instruction of the runnable will ever be executed.

But when a context switch comes, the thread is paused, not stopped.

Kalman said:   10 years ago
I'm sure that stopping a thread and putting it into the ready state in favor of a higher priority thread are completely different things.

F J said:   1 decade ago
#2 is not true on a system with an multiprocessor machine. When a thread of higher priority becomes runnable, it will start executing, but that does not mean the current thread will stop.

Ainul Habib said:   1 decade ago
Hi !
Deprecated methods should not be in practice test, because in later version the method itself can be removed. 'stop' method in this case should never be used to stop any thread, in-fact it should be handled differently

Stinger said:   1 decade ago
stop method is deprecated and considered dangerous to use.

Thomas said:   1 decade ago
I think this question and answer will confuse lerners.

My opinion is first: when an other thread with higher priority becomes runnable the vm might stop the executing of the currently running thread.

Second: the stop method is marked as deprecated so no question should base on it.

Post your comments here:

Your comments will be displayed after verification.