Originally posted by Lhy Killers:
Why no one help me to solve the examination question???
Because you didn't even wait two hours for an answer!!
On your first question:
The two that can't directly stop a
thread from executing are notify and notifyAll. Of the others:
Yield will at least temporalily halt the thread, it may be restarted right away by the scheduler. wait will cause the thread to wait until it receives a notify or notifyAll. And if the thread is already running then calling start on it will throw an IllegalThreadStateException.
notify and notifyAll can not directly cause the thread to stop, but if the thread calling them doesn't have the lock on an object they'll throw an IllegalMonitorStateException when the try to call one of those two.
Given the way the question is worded it may have been done better or given little more info.
Hope that helps
Dave