又有个问题看不明白了,难道猪就~?
class point{ // 程序4-8
int x, y;
point(int x, int y){
System.out.println("父类构造函数被调用!"+x+" "+y);
}
}
class circle extends point{
circle(int r, int x, int y){
super(x, y);
System.out.println("子类构造函数被调用!");
System.out.println(r+" "+x+" "+y) ;
}
}
public class testInherence {
public static void main(String args[ ]) {
circle c1=new circle(1,1,1);
System.out.println(c1.x+" "+c1.y);
}
}
为什么 System.out.println(c1.x+" "+c1.y); 的结果是 0 0 , 而不是1 1 呢?