This is my simple program in Java:
public class Counter extends Thread {
public static void main(String args[]) {
Thread t1 = new Thread();
Thread t2 = new Thread();
t1.start();
t2.start();
}
}
I am using Windows Operating System 32-bit. My question is, how can we know how many Threads are created in the program and how many Threads are running? Is there any such tool?
System.out.println(“Number of active threads from the given thread: ” + Thread.activeCount());