Describe the life cycle of a thread in Java?
Answers
Answered by
0
Answer:
For example, a thread is born, started, runs, and then dies. The following diagram shows the complete life cycle of a thread. New − A new thread begins its life cycle in the new state. ... Runnable − After a newly born thread is started, the thread becomes runnable.
Explanation:
Answered by
1
Each thread undergoes five stages are New, Runnable, Running, Blocked and Dead.
Explanation:
- Java is a multi-threading language so in java programmers can write program in which more than one processes can be executed concurrently.
- New: It is the starting stage when the thread has been created but it has not started to run.
- Runnable: It is the second stage , in this stage the thread is ready to run and it is waiting in queue for the processor.
- Running: It is the third stage , in this stage the thread is being executed.
- Blocked: It is the fourth stage, in this stage the thread is stopped from running.
- Dead: It is the last stage,in this stage the thread finishes its execution or stopped by another thread.
learn more about thread in Java
What is thread in java?
https://brainly.in/question/8878917
Difference between suspending and stoping thread in java
https://brainly.in/question/4090801
Attachments:
Similar questions