请教一个关于对象声明的问题?
class A1{
public int A1(int a)
{
return a+1;
}
}
class B1 extends A1
{
public int B1(int a)
{ this.a=a;
return a+2;
}
public static void main(String args[])
{
A1 a1=new B1(2);
System.out.println(a1.A1(0));
}
}
编译时出现错误:
symbol :constructor B1(int)
location :class B1
A1 a1=new B1(2);
为什么会错呢?