Java Thread destroy() methodLast Updated : 17 Mar 2025 The destroy() method of thread 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. SyntaxReturnIt doesn't return any value. ExceptionIllegalThreadStateException: 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. ExampleOutput: Thread-1 finished executing Thread-2 finished executing child thread destroyed Parent thread destroyed Next TopicMultithreading Java |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India