一个主线程,负责启动程序,打印ok。
另一个线程启动后,先打印run,然后死于while循环中。
没什么啊,你一直没有从while循环中跳出来啊。不信你在while循环中写上打印语句,会有无数的打印结果

解决方案 »

  1.   

    public ThreadExt()
    {
    this.start();
    }
    试试
      

  2.   

    线程不应该这样启动,应该用start而不是直接调用run,你这样做是在同一个县城里面运行test的run函数,当然不能并行public class ThreadExt extends Thread
    {
    public ThreadExt()
    {
    }
    public void run()
    {
    System.out.println("run");
    while(true)
    {
    }
    }
    public static void main(String args[])
    {
    ThreadExt test=new ThreadExt();
                       test.start();
    System.out.println("OK");
    }
    }