Javatpoint Logo
Javatpoint Logo

Java ThreadGroup activeCount() method

The activeCount() method of ThreadGroup class is used to return the number of active threads in the current thread's thread group. The returned value is only an estimate because the number of threads may change dynamically while this method traverses internal data structures.

Syntax

Return

It returns the number of active threads in the current thread's thread group.

Example

Test it Now

Output:

Number of active thread: 3
Thread-1 completed executing
Thread-2 completed executing
Thread-3 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