Home » Java Thread activeCount() Method with Examples

Java Thread activeCount() Method with Examples

by Online Tutorials Library

Java Thread activeCount() method

The activeCount() method of thread class is used to return the number of active threads in the current thread’s thread group. The value returned 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: 2  running thread name is: Thread-1  running thread name is: Thread-2  

You may also like