76
Java ThreadGroup setDaemon() method
The setDaemon() method of ThreadGroup class tests if the thread group is a daemon thread group.
Syntax:
Parameter:
daemon: If true, marks the thread group as a daemon thread group; otherwise, marks the thread group as normal.
Exception:
SecurityException: If the current thread cannot modify the thread group.
Example
Output:
Is Parent thread a daemon threadGroup? true Is Child thread a daemon threadGroup? false Thread-1 completed executing Thread-2 completed executing
Next TopicThreadGroup in Java