public class Shape{
public int xPos = 10;
public int yPos = 20;
Shape(){
}
public int getXpos(){
return xPos;
}
public void setXpos(int x){
this.xPos = x;
}
public int getYpos(){
return yPos;
}
public void setYpos(int y){
this.yPos = y;
}
}
public class Shape1 extends Shape{
Shape1(){
xPos = 100;
yPos = 200;
}
}
public class Test{
public static void main(String[] args) {
Shape1 shape1 = new Shape1();
System.out.println(shape1.getXpos());
}
}
結果として100ではなく10を取得するのはなぜですか?