When does a Java Thread reach the 'Die' State

后端 未结 4 679
既然无缘
既然无缘 2020-11-30 05:04

In Java, Die is one of the states on a thread.

What causes a thread to enter this state?

4条回答
  •  一生所求
    2020-11-30 05:26

    There are two ways for a thread to die:

    a) It could die of natural causes which is when the run() method finishes or return,

    or

    b) it could be kill by using the stop() method or when something goes wrong with the program(This could be an Exception) or computer.

提交回复
热议问题