In Java, threads have 5 different states: New, Runable, Running, Blocked and Dead. The conversion diagram between them is as follows:
There is an exception in the above figure. Calling the yield() method can transfer the currently running thread to the ready state. If you want to test whether a thread has died, you can use the isAlive() method, which returns true when the thread is ready, running, or blocked, and returns false when it is created or dies. Do not try to restart a dead thread by calling the start() method. Death means death, just like human beings, it is impossible to regenerate. Also, do not call the start() method twice on a thread, as this will also cause an exception.