What does a java thread do after running?

In a game, I'm using many instances of a thread, and it won't track them

clientThread cT = new clientThread(socket);
new Thread(cT).start();

What I need to know is that when an instance of the tread is completed (all cycles have been completed and it is no longer used), is it discarded like an instance of a method? Or do I need to use a special piece of code to discard it?

Solution

This thread is a normal object and will be garbage collected like any other object For Thread objects, when the thread exits, it is eligible for collection

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>