有关线程的一道题:
Which two CANNOT directly cause a thread to stop
executing? (Choose Two)
A. Calling the yield method
B. Calling the wait method on an object
C. Calling the notify method on an object
D. Calling the NotifyAll method on an object
E. Calling the start method on another Thread object 请问:什么是“CANNOT directly cause a thread to stop”是什么意思,还有“directly cause a thread to stop”吗?此话怎讲。
Which two CANNOT directly cause a thread to stop
executing? (Choose Two)
A. Calling the yield method
B. Calling the wait method on an object
C. Calling the notify method on an object
D. Calling the NotifyAll method on an object
E. Calling the start method on another Thread object 请问:什么是“CANNOT directly cause a thread to stop”是什么意思,还有“directly cause a thread to stop”吗?此话怎讲。
可什么是“不能直接导致正在执行的线程终止”呢?
B为什么不对?
我理解的yield()方法是当前线程放弃CPU的使用,将使用权交给另一个线程,但并没有终止啊。请解释一下yield()的用法吧,谢谢!!!