62,621
社区成员
发帖
与我相关
我的任务
分享
public class Test8 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TestThread t = new TestThread();
//t.start(); //start的话,打印结果是2
t.run(); //用run的话,打印结果是1
System.out.println(Thread.activeCount()); //求出活动线程数量
}
}
class TestThread extends Thread{
public void run(){
System.out.println("class TestThread 's thread");
}
}