Java ThreadGroup parentOf() method
The parentOf() method of ThreadGroup class tests if the thread group is either the argument of thread group or one of its ancestor thread groups.
g: It is the thread group
It returns true if the invoking thread is the parent of group. Otherwise, it returns false.
ExampleTest it Now
Thread-1 starts Thread-2 starts Child thread is the parent of Parent thread: false Parent thread is the parent of Child thread: true Thread-1 completed executing Thread-2 completed executing