Java ThreadGroup getParent() methodThe 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. ExampleTest it NowOutput: 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
Next TopicThreadGroup in Java
|