日期:2014-05-20  浏览次数:20681 次

求助!!帮手修改线程(新手)
public   class   Test9
{  
    public   static   void   main(String[]   args)
      {
    Thread1   T1   =   new   Thread1(first);
    Thread2   T   =   new   Thread(second);
      Thread   T2   =new   Thread(T);
    T1.start();
T2.start();
        }


    class   Thread1   extends   Thread  
          {
        public   Thread1(String   threadName){
super(threadName);

}
    public   void   run   ()   {
{
      System.out.println( "第一条线程 ");
return;
    }
            }


    class   Thread2   implement   Runnable
        {
  private   string   name;
  public   Thread2(string   name){
this.name=name;
}
  public   void   run(){
System.out.println( "第二条2条 ");
return;
}
        }
}有6个错五显示.
帮忙修改一下.谢谢拉!

------解决方案--------------------
这个也拿来问。。。。。
找本书抄,也找个好点的。。。
估计你的行参,实参 都还没理解把。。
------解决方案--------------------
Thread1 T1 = new Thread1(first);//first要加 " "
Thread2 T = new Thread(second);//同上
class Thread2 implement Runnable//implement 要加s
string name//string要大写
括号的嵌套也有问题

LZ你应该自己好好看了代码改改,并不是很难的东西
------解决方案--------------------
顶上
------解决方案--------------------
public class Test9
{
public static void main(String[] args)
{
Thread1 T1 = new Thread1( "first ");
Thread2 T = new Thread2( "second ");
Thread T2 =new Thread(T);
T1.start();
T2.start();
}

}


class Thread1 extends Thread
{
public Thread1(String threadName)
{
super(threadName);
}
public void run ()
{
System.out.println( "第一条线程 ");
return;
}
}


class Thread2 implements Runnable
{
private String name;
public Thread2(String name)
{
this.name=name;
}
public void run()
{
System.out.println( "第一条线程 ");
return;
}
}

改了下,运行编译没问题
------解决方案--------------------
run方法里面不需要return吧?