black

Java认证考试综合练习

登录

多项选择题

1. class HorseRadish {  
2. // insert code here  
3. protected HorseRadish(int x) { 
4. System.out.println("bok choy");  
5. }  
6. }  
7. class Wasabi extends HorseRadish {  
8. public static void main(String [] args) {  
9. Wasabi w = new Wasabi(); 
10. }  
11. }  
分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?()  

A. // just a comment
B. protected HorseRadish() { }
C. protected HorseRadish() { this(42);}
D. protected HorseRadish() { new HorseRadish (42);}

相关考题

多项选择题 1. class Synapse {   2. protected int gap() { return 7; }   3. }   4.   5. class Creb extends Synapse { 6. // insert code here  7. }  分别插入到第 6 行,哪三行可以编译?()

多项选择题 public class TestDemo{   private int x = 2;   static int y = 3;   public void method(){   final int i=100;   int j = 10;   class Cinner{   public void mymethod(){  //Here  }  }  }  }   在Here处可以访问的变量是哪些?()

单项选择题 class Rectangle {   public static void main(String [] args) {   int [] x = {1,2,3};   x[1] = (x[1] 〉 1) ? x[2] : 0;   System.out.println(x[1]);   }   }   结果为:()

All Rights Reserved 版权所有©计算机考试题库(jsjtiku.com)

备案号:湘ICP备14005140号-4

经营许可证号:湘B2-20140064