What is the life cycle of Thread ?
Answer Posted / sasikala d
1. New state - After the creations of Thread instance
the thread is in this state but before the start() method
invocation. At this point, the thread is considered not
alive.
2. Runnable (Ready-to-run) state - A thread start its
life from Runnable state. A thread first enters runnable
state after the invoking of start() method but a thread can
return to this state after either running, waiting,
sleeping or coming back from blocked state also. On this
state a thread is waiting for a turn on processor.
3. Running state - A thread is in running state that
means the thread is currently executing. There are several
ways to enter in Runnable state but there is only one way
to enter in Running state: the scheduler select a thread
from runnable pool.
4. Dead state - A thread can be considered dead when
its run() method completes. If any thread comes on this
state that means it cannot ever run again.
5. Blocked - A thread can enter in this state because
of waiting the resources that are hold by another thread.
| Is This Answer Correct ? | 16 Yes | 2 No |
Post New Answer View All Answers
Which java version is latest?
What are the data types supported by java? What is autoboxing and unboxing?
Is linked list a linear or non-linear data structure?
Can I learn java in 3 months?
What is the difference between delete and delete[]
How can we make sure main() is the last thread to finish in java program?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?
What are the types of strings?
What is data type modifier?
What is the exact difference in between unicast and multicast object? Where we will use?
Can we inherit a class with private constructor?
How do you check if a string contains only numeric digits?
What is treeset in java?
What is volatile data type?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?