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