Totel:29 Click: 1 2 3 4 5 6
When the running method is completely end then we use this state .That's means the thread is dead,now a time its also a thread object but its not for the execution.Once a thread is dead, it can never be brought back to life! if we 'll invoke start() on a dead Thread instance, we will get a runtime exception. And it probably doesn't take a rocket scientist to tell us that if a thread is dead, it is no longer considered to be alive.
The thread may be blocked waiting for a resourcein which case the event that sends it back to runnable is the availability of the resource for example, if data comes in through the input stream the thread code is reading from, or if the object's lock suddenly becomes available.A thread may be sleeping because the thread's run code tells it to sleep for some period of time, in which case the event that sends it back to runnable is that it wakes up because its sleep time has expired. Or the thread may be waiting, because the thread's run code causes it to wait, in which case the event that sends it back to runnable is that another thread sends a notification that it may no longer be necessary for the thread to wait.
The important point is that one thread does not tell another thread to block. There is a method, suspend(), in the Thread class, that lets one thread tell another to suspend, but the suspend()method has been deprecated and won't be on the exam (nor will its counterpart resume()). There is also a stop() method, but it too has been deprecated and we won't even go there. Both suspend() and stop() turned out to be very dangerous.
In this state thread is now ruining state and also thread scheduler select it for there the running state.
Runnable state basically which state when our thread ready for the run .But in that time also thread scheduler didn't select for the running state .When the thread is enters the in this state the start method is invoked.When the thread is in the runnable state, it is considered alive.
New thread state is the state basically the thread in this stage exactly not alive means its alive as a Thread object.but in this condition its not yet thread of execution.that's y we consider that time its not alive. this state mainly thread is in after the Thread instance has been instantiated, but the start() method has not been invoked on the thread.
1 2 3 4 5 6