I need confirmation on this. Somewhere in Dan's online mock, I ran into this question. Well, to keep the question short here is the version of it.
Choice # 1 - The Thread.sleep method causes the thread to move to the Not-Runnable state
Choice # 2 - The Thread.sleep method causes the thread to move to the Ready state
Which one is the correct choice ? To me, Not-Runnable means dead and Ready means before the run method is call. I have chosen #2 because sleep will wake up and when it got up it will be in the thread pool and waiting for its lucky queue. While Dan's answer was the #1, which means after invoking sleep the thread is dead and while if a thread is dead it cannot be re-started.
Thx in adv. k
Unity can only be manifested by the Binary. Unity itself and the idea of Unity are already two.
Kay, The choice 1 is correct because the thread goes into non-runnable state in the following instances
1> Thread is blocked waiting for I/O resource or the object's lock . 2> The thread's run method might tell to sleep for some time. 3> The thread may be waiting because the thread's method called wait() method.
So I feel, not runnable means Waiting/blocking/sleeping that is what Dan Chisholm meant too.
Hope this helps ya.
Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Joined: Dec 03, 2003
To add - if Thread is calling join on another thread, it goes to non-runnable state