class Square
{
private double border;
public Square()
{
this(border); //这里出错
} public Square(double border)
{
System.out.println(border);
}
}为什么会出现错误?
Cannot refer to an instance field border while explicitly invoking a constructor
border不是初始化了才执行构造函数的吗?
{
private double border;
public Square()
{
this(border); //这里出错
} public Square(double border)
{
System.out.println(border);
}
}为什么会出现错误?
Cannot refer to an instance field border while explicitly invoking a constructor
border不是初始化了才执行构造函数的吗?
- Cannot refer to 'this' nor 'super' while explicitly invoking a
constructor
- Cannot refer to an instance field border while explicitly invoking a
constructor