Javatpoint Logo
Javatpoint Logo

Java ThreadGroup interrupt() method

The interrupt() method of ThreadGroup class is used to interrupt all the threads in the thread group.

Syntax

Return

This method does not return any value.

Exception

SecurityException: This exception throws if the current thread is not allowed to access the thread group or any of the threads in the thread group.

Example

Test it Now

Output:

Thread-1 starts
Thread-2 starts
Thread-1 interrupted
Thread-1 completed executing
Thread-2 completed executing





Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA