black

SCJP程序员认证考试

登录

单项选择题

class Super { 
public int i = 0; 
public Super(String text) { 
i = 1;
} 
} 
public class Sub extends Super { 
public Sub(String text) { 
i = 2; 
} 
 public static void main(String args[]) { 
Sub sub = new Sub(“Hello”); 
System.out.println(sub.i); 
} 
} 
What is the result?()  

A. 0
B. 1
C. 2
D. Compilation fails.

相关考题

多项选择题 class A {  }  class Alpha {  private A myA = new A();  void dolt( A a ) {  a = null;  }  void tryIt() {  dolt( myA );  }  }  Which two statements are correct?()

单项选择题 public class Test {  public static void main(String Args[]) {  int i =1, j = 0;  switch(i) {  case 2: j +=6;  case 4: j +=1;  default: j +=2;  case 0: j +=4;  }  System.out.println(“j =” +j);  }  }  What is the result? ()

多项选择题 int i = 0, j = 5;  tp;   for (;;) {  i++;  for(;;) {  if (i> --j) {  break tp;  break tp;  }  }  System.out.println(“i=” +i “,j =”+j); } What is the result?()

All Rights Reserved 版权所有©财会考试题库(ckkao.com)

备案号:湘ICP备2022003000号-2