public class AbstractImpl extends AbstractClass{
private int i=10;
@Override
public void print() {
System.out.println("this is an abstract test "+i);
}
public static void main(String[] args) {
AbstractClass a=new AbstractImpl();
a.print();
}
}
public abstract class AbstractClass {
public AbstractClass() {
print();
}
public abstract void print();
}
打印结果为啥是
this is an abstract test 0
this is an abstract test 10
求大神帮帮小白