我运行了这段代码并得到了以下结果:
//back in main
//directly from the runnable
//top of the stack
Run Code Online (Sandbox Code Playgroud)
我不应该top of the stack作为第一个结果吗?
public class MyRunnable implements Runnable {
public void run() {
System.out.println("directly from the runnable");
go();
}
public void go() {
doMore();
}
public void doMore() {
System.out.println("top of the stack");
}
}
public class ThreadTester{
public static void main(String[] args) {
Runnable threadJob = new MyRunnable();
Thread myThread = new Thread(threadJob);
myThread.start();
System.out.println("back in main");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
351 次 |
| 最近记录: |