while(true)
     {   try
       {line=in.readUTF();}
       catch(IOException e)
        {}
     }
这个循环跳不出来 可能是死在里面了

解决方案 »

  1.   

    可是一旦 Thread.currentThread()==netThread
    那么 程序就会一直在 while(true) 里面 循环
    根本不会再理会 Thread.currentThread()==gameThread 了
      

  2.   

    你把两个循环分成两个线成来写就可以了。样例如下:public class MainTest
    {
        Thread ta,tb;
    class A implements Runnable
    {
        public void run()
        {
            while(true)
            {
                if (Thread.currentThread()==ta)
                {
                    System.out.println("A");            }
            }
        }
    }
    class B implements Runnable
    {
        public void run()
        {
            while(true)
            {
                if (Thread.currentThread()==tb)
                {
                    System.out.println("B");            }
            }
        }
    }    public MainTest()
        {
        }
    public static void main(String[] args) {
       MainTest t = new MainTest();
       t.ta = new Thread(t.new A(),"A");
       t.tb = new Thread(t.new B(),"B");
       t.ta.start();
       t.tb.start();}
    }