关于多线程的两道选择题
求解下面两道题的详细分析,求大牛指导!
1. 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
Ans:A E
2. Which two CANNOT directly cause a thread to stop executing? (Choose Two)
A.Existing from a synchronized block
B.Calling the wait method on an object
C.Calling notify method on an object
D.Calling read method on an InputStream object
E.Calling the SetPriority method on a Thread object
Ans:A C
这两道题的答案很矛盾,第2题的C 就是第1题的C,但是一个是答案,一个不是答案。
题目中说的“CANNOT directly cause” 到底指的哪种:
(1)会导致线程停止运行,但是也可能不会导致。
(2) 无论怎么样也不会导致线程运行。
求指导!