Javatpoint Logo
Javatpoint Logo

Java ThreadGroup getParent() method

The getParent() method of ThreadGroup class returns the parent of the thread group.

Syntax:

Return:

This method returns the parent of the thread group.

Exception:

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

Example

Test it Now

Output:

Starting Thread-1
Starting Thread-2
ParentThreadGroup for Parent thread is main
ParentThreadGroup for Child thread is Parent thread
Thread-1 completed executing
Thread-2 completed executing






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA