thread about java

1 java thread is also an object

Therefore, the java thread object is also destroyed by gc.

2 java thread object waiting for the timing to be destroyed

When the java thread finishes executing the run() method, it is waiting to be destroyed, so the only way to prevent a thread object from being destroyed is to create an infinite loop in the run method. Infinite loops are really used everywhere in java.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324838375&siteId=291194637