Javatpoint Logo
Javatpoint Logo

Java ThreadGroup destroy() method

The destroy() method of ThreadGroup class is used to destroy the thread group and all of its subgroups. The thread group must be empty, indicating that all threads that had been in the thread group have since stopped.



It doesn't return any value.


IllegalThreadStateException: This exception throws if the thread group is not empty or if the thread group has already been destroyed.

SecurityException: If the current thread cannot modify this thread group.


Test it Now


Thread-1 finished executing
Thread-2 finished executing
Child thread destroyed
Parent thread destroyed

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA