Java ThreadGroup interrupt() methodThe interrupt() method of ThreadGroup class is used to interrupt all the threads in the thread group. SyntaxReturnThis method does not return any value. ExceptionSecurityException: This exception throws if the current thread is not allowed to access the thread group or any of the threads in the thread group. ExampleTest it NowOutput: Thread-1 starts Thread-2 starts Thread-1 interrupted Thread-1 completed executing Thread-2 completed executing
Next TopicThreadGroup in Java
|