Which three guarantee that a thread will leave the running state?
Note
(B), (E), and (F) is correct because -
wait()
always causes the current thread to go into the object's wait pool.sleep()
will always pause the currently running thread for at least the duration specified in the sleep argument (unless an interrupted exception is thrown).- assuming that the thread you're calling
join()
on is alive, the thread callingjoin()
will immediately block until the thread you're callingjoin()
on is no longer alive.
(A) is wrong, but tempting. The yield()
method is not guaranteed to cause a thread to leave the running state, although if there are runnable threads of the same priority as the currently running thread, then the current thread will probably leave the running state.
(C) and (D) are incorrect because they don't cause the thread invoking them to leave the running state.
(G) is wrong because there's no such method.