Javatpoint Logo
Javatpoint Logo

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

Test it Now

Output:

Is Parent thread a daemon threadGroup? true
Is Child thread a daemon threadGroup? false
Thread-1 completed executing
Thread-2 completed executing





Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA