早教吧作业答案频道 -->其他-->
能给解释解释为什么选CD吗(java)1.classSuper{2.privateinta;3.protectedSuper(inta){this.a=a;}4.}...11.classSubextendsSuper{12.publicSub(inta){super(a);}13.publicSub(){this.a=5;}14.}Whichtwo,independently,willall
题目详情
能给解释解释为什么选CD吗(java)
1. class Super{
2. private int a;
3. protected Super(int a){this.a = a;}
4. }
...
11. class Sub extends Super{
12. public Sub(int a){super(a);}
13. public Sub(){this.a = 5;}
14. }
Which two, independently, will allow Sub to compile? (Choose two.)
A. Change line 2 to:
public int a;
B. Change line 2 to:
protected int a;
C. Change line 13 to:
public Sub(){this(5);}
D. Change line 13 to:
public Sub(){super(5);}
E. Change line 13 to:
public Sub(){super(a);}
1. class Super{
2. private int a;
3. protected Super(int a){this.a = a;}
4. }
...
11. class Sub extends Super{
12. public Sub(int a){super(a);}
13. public Sub(){this.a = 5;}
14. }
Which two, independently, will allow Sub to compile? (Choose two.)
A. Change line 2 to:
public int a;
B. Change line 2 to:
protected int a;
C. Change line 13 to:
public Sub(){this(5);}
D. Change line 13 to:
public Sub(){super(5);}
E. Change line 13 to:
public Sub(){super(a);}
▼优质解答
答案和解析
C. Change line 13 to:
public Sub(){this(5);} // 执行的是12行,this(5)找的是Sub类的对应构造方法
D. Change line 13 to:
public Sub(){super(5);} //执行的是3行,super(5)找的是父类对应的构造方法
public Sub(){this(5);} // 执行的是12行,this(5)找的是Sub类的对应构造方法
D. Change line 13 to:
public Sub(){super(5);} //执行的是3行,super(5)找的是父类对应的构造方法
看了能给解释解释为什么选CD吗(j...的网友还看了以下:
编程的英语翻译Visual Basic 、Delphi 、VC++ ( C++ Builder ) 2020-05-13 …
JAVA题目下面CE为什么不对~~求解释~~~10.abstractclassA{11.abstr 2020-05-17 …
java的简单习题要详细的解释谢谢1)在Java类中,使用以下()声明语句来定义公有的int型常量 2020-07-11 …
java问题:每一项都详细解释下1.下列关于Java语言中String和char的说法,正确的是( 2020-07-17 …
java问题:每一项都详细解释下以下关于Object类的说法正确的是(A)A.Java中所有的类都 2020-07-17 …
java问题:每一项都详细解释下1.下列关于Java中类的构造方法的描述,正确的是(B)A.构造方 2020-07-17 …
英语改错,大括号中的4项有一项是错的,请选出并解释,13、Since{the1950’s}(A),f 2020-10-30 …
VB求解释13.以下程序输出的结果是D。Dimaa=array(1,2,3,4,5,6,7)ForI 2020-10-30 …
能给解释解释为什么选CD吗(java)1.classSuper{2.privateinta;3.pr 2020-10-30 …
走过路过不要错过啊!一般现在时和现在完成时的选择题啊!做对有奖啊!前提是给点解释!13.-Where 2020-12-27 …