62,612
社区成员
发帖
与我相关
我的任务
分享
public class TestThread {
public static void main(String args[]) {
System.out.println("Hello") ; 当运行main主线程就进到栈A里
new TestThread().method() ;
}
public void method() {
Runnable r = new MyRunnable() ;
Thread t = new MyThread(r) ;
t.start() ; //当到这儿的时候 run()就进到了栈B里.
}
}
再有线程出来的时候就会排列,最后形成一个线程栈。