In Java, Die is one of the states on a thread.
What causes a thread to enter this state?
From the Thread API, here is a complete list:
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.
All Thread
s die either by returning from the call to the run
method or by throwing an exception that propagates beyond the run
method.
Threads die in the following situations: