I want to know how many active threads are there for a particular Thread class. Lets say I have a class T which extends thread. In some other class (Ex: Demo) , I want to get t
Your Thread (or Runnable) subclass can maintain a static active count. Increment when run() starts, decrement when run() ends (in a finally block).
Thread
Runnable
static
run()
finally
Make sure the increment/decrement is done in a multithread secure way.