20170321问题解析请点击今日问题下方的“【Java每日一题】20170322”查看(问题解析在公众号首发,公众号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");
}
}
今日问题:
请问主程序运行结果是什么?(点击以下“【Java每日一题】20170322”查看20170321问题解析)
题目原发布于公众号、简书:【Java每日一题】20170322,【Java每日一题】20170322 (也可以扫描头像二维码查看)