You saw in the ThreadGroup class that the method activeCount returned an estimate of the number of threads running within that ThreadGroup. The Thread class itself also has a method called activeCount. It is a static method that returns the number of threads that are running within the thread's ThreadGroup. Using this method, you don't have to get the ThreadGroup for the thread and ask it. |