- class MyThread extends Thread{
- public void run(){
- try {
- Thread.currentThread().sleep(3000);
- } catch (InterruptedException e) {
- }
- System.out.println("MyThread running");
- }
- }
- public class ThreadTest{
- public static void main(String argv[]) {
- MyThread t = new MyThread();
- t.run();
- t.start();
- System.out.println("Thread Test");
- }
- }
复制代码 这段代码最后为什么是打印MyThread running 整个的线程的执行顺序是怎么回事啊,看了半天有点混乱。 |
|