class Demo {
String s = "Outer";
public static void main (String[] args) {
S2 s2 = new S2();
s2.display();
}
}
class S1 {
String s = "S1";
public void display(){
System.out.println(s);
}
}
class S2 extends S1 {
String s = "S2";
}
这题答案是S1 因为·继承,子对象里面有两个s,一个是父类的,一个是子类的,怎么确定,怎么去理解,赢比喻最好啦 |
|