请问该程序的运行结果是什么?
class Demo {
String s = "Outer";
public static void main (String[] args) {
S2 s2 = new S2();
s2.display();//S1
}
}
class S1 {
String s = "S1";
public void display(){
System.out.println(s);
}
}
class S2 extends S1 {
String s = "S2";
}
这道题的结果已经知道,但是还是不懂程序运行过程,请高手指教,具体怎么运行的 |
|