Home » Java ThreadGroup getParent() method with Examples

Java ThreadGroup getParent() method with Examples

by Online Tutorials Library

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  

You may also like