black

SCJP程序员认证考试

登录

单项选择题

What will be written to the standard output when the following program is run?()  
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 Qd073 {  
public static void main(String args[]) {  bogo(new Extension());  }  
static void bogo(Base b) {  b.add(8);  b.print();  
}  
}  

A.9
B.18
C.20
D.21
E.22

相关考题

单项选择题 WhatdoesthevaluereturnedbythemethodgetID()foundinclassjava.awt.AWTEventuniquelyidentify?()

单项选择题 Whencreatingaclassthatassociatesasetofkeyswithasetofvalues,whichoftheseinterfacesismostapplicable?()

单项选择题 Underwhichcircumstanceswillathreadstop?()

All Rights Reserved 版权所有©建筑考试题库(jzkao.com)

备案号:湘ICP备2020024380号-3