public class RectangleEx extends Rectangle
{
int height =0;
int width=0;
public RectangleEx(int height, int width)
{
super(height,width);
}
public RectangleEx()
{
super(0,0);
this.setHeight(5);
System.out.println(this.height);
}
}
2 番目のコンストラクターを使用して新しい RectangleEx を作成するときに、その高さが 5 ではなく 0 である理由を誰か教えてもらえますか? これは、スーパークラスの setHeight のコードです。
public void setHeight(int height)
{
this.height = height;
}