This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi friends, i dint understand the phrase "cannot directly cause a thread to stop executing" . 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.
Hi, The answers would be notify and notifyAll(). wait() and yield directtly stop the current thread from executing. However after invoking notify() and notifyAll() methods, the current thread doesn't stop executing, only after the current thread has completed, rest of threads can execute. If a thread calls start() method of another thread (threadB), if a VM runs another thread(threadB) current thread stops. Hence notify() and notifyAll() are right answers. Let me know if this helps.