老大,你的while语句判断的友问题,你这个是个死循环,别的友怎么能插手呢!?

解决方案 »

  1.   

    while(true)
    {
      try
      {
        ...
        sleep(200);   //因为TryThread是Thread的子类,“Thread.”可以省略
      }
      catch(InterruptedException e)
      { 
        ...
      }
    }
    在public static void main(String[] args)中,启动线程使用t1.start();
    t2.start();
    t3.start();
    是正规用法
      

  2.   

    楼上的说得不错,启动线程用*.start()
    如果想要线程能自动终止,最好加上生存时间控制。
    public class TryThread extends Thread
    {
    private String name;
    private int age;
             private int life;
    .......
    .......
    ....... 
             public TryThread(String n, int a,int l)
    {
    this.name = n;
    this.age = a;
                      life = l;                  
    }
             public void run()
    {
                      int i = 0;
    while( i < life)

                          try{
                              i++;
                          .............
      

  3.   

    没有star()启动也算线程。。那不活一个死循环吗。
      

  4.   

    调用start()方法启动一个线程
    调用run()方法相当于调用一个过程,并没有启动线程