确定线程数目
package demo1;
public class TT {
public static void main(String[] args) {
T t1;
t1 = new T();
System.out.println("线程活动数目:"+Thread.activeCount());
t1.start();
// activeCount()返回当前线程的线程组中活动线程的数目。
System.out.println("线程活动数目:"+Thread.activeCount());
}
}
class T extends Thread{
//死循环
public void run() {
while(true) {
}
}
}