因簡(jiǎn)書改版后無(wú)法添加擴(kuò)展鏈接盔性,20170321問(wèn)題解析請(qǐng)到公眾號(hào)查看,問(wèn)題解析在公眾號(hào)首發(fā)尽超,公眾號(hào)ID:weknow619般贼。
package Mar2017;
public class Ques0322 {
public static void main(String[] args) {
Super sup = new Sub();
System.out.println(sup.index + ",");
sup.print();
}
}
class Super {
int index = 1;
public void print() {
System.out.println("Super");
}
}
class Sub extends Super {
int index = 2;
public void print() {
System.out.println("Sub");
}
}
今日問(wèn)題:
請(qǐng)問(wèn)主程序運(yùn)行結(jié)果是什么?