abstract class A{
public A(){
this.print() ;
}
public abstract void print() ;
};
class B extends A{
private int x = 100 ;
public B(int x){
this.x = x ;
}
public void print(){
System.out.println("x = " + x) ;
}
};
public class TestJava{
public static void main(String args[]){
A a = new B(10) ;
}
};
为什么输出的是0啊?求解释 |