首页 > 职业考试题库1 > 题目详情
下面程序段的输出结果是class Base{ int i; Base() {ad
题目内容:
[单选题]下面程序段的输出结果是 class Base { int i; Base() { add(1); } void add(int v) { i+=v; } void print() { System.out.println(i); } } class Extension extends Base { Extension() { add(2); } void add(int v) { i+=v*2; } } public class Test { public static void main(String args[]) { bogo(new Extension()); } static void bogo(Baseb){ b.add(8); b.print(); } }
A.9
B.18
C.20
D.22
本题链接: