java 无法将类 A中的构造器 A应用到给定类型;

class A extends Thread
{
B b;
public void A(B b){
this.b=b;
}
public void run(){
synchronized(this)
{
System.out.println(getName()+"方法开始停止");
try
{
sleep(5000);
}
catch (Exception e)
{
}
System.out.println(getName()+"方法重新运行");
}
}
public static void main(String[] args)
{
B obj=new B();
A obj1=new A(obj);
A obj2=new A(obj);
obj1.start();
obj2.start();
}
}
class B
{
}

public void A(B b){
this.b=b;
}
不用写返回类型。构造器是没有返回类型的。
温馨提示:答案为网友推荐,仅供参考
相似回答