public class Base {//父类
private int i = 2 ;
public Base(){
this.display() ;
}
public void display(){
System.out.println(i);
}
}
子类中代码如下:
public class Derived extends Base {
private int i = 22 ;
public Derived(){
i = 222 ;
}
public void display(){
System.out.println(i);
}
}
测试用例如下:
public class Test {
public static void main(String[] args) {
new Derived() ;
}
}
请问结果是?
|
|