Java ThreadGroup parentOf() methodThe parentOf() method of ThreadGroup class tests if the thread group is either the argument of thread group or one of its ancestor thread groups. SyntaxParameterg: It is the thread group ReturnIt returns true if the invoking thread is the parent of group. Otherwise, it returns false. ExampleTest it NowOutput: 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
Next TopicMultithreading Java
|