【发布时间】:2019-10-05 14:11:18
【问题描述】:
谁能解释一下下面的代码
public class TestThread implements Runnable {
public static void main(String[] args) {
Thread thread = new Thread(new TestThread());
thread.start();
System.out.println("1");
thread.run();
System.out.println("2");
}
@Override
public void run() {
System.out.println("3");
}
}
输出结果为 1 3 3 2。请有人解释一下。
提前致谢
【问题讨论】:
-
看Java多线程基础就好了。
-
您还期待什么其他结果?为什么?
标签: java multithreading