现有如下代码[br][/br]class Super{ [br][/br] public float getNum(){return 3.0f;} [br][/br] } [br][/br]public class Sub extends Super{ [br][/br] //【代码】[br][/br]} [br][/br]在【代码】标注行加入下列哪行代码后会导致程序编译错误
A: public float getNum(){return 4.0f;}
B: public void getNum(){}
C: public void getNum(double){}
D: public double getNum(float d){return 4.0d;}
A: public float getNum(){return 4.0f;}
B: public void getNum(){}
C: public void getNum(double){}
D: public double getNum(float d){return 4.0d;}
举一反三
- } [br][/br]在第5行加入下列哪行代码后会导致程序编译错误 A: public float getNum(){return 4.0f;} B: public void getNum(){} C: public void getNum(double D: {} <br> <br>public double getNum(float d){return 4.0d;}
- 现有如下代码 1: class Super{ 2: public float getNum(){return 3.0f;} 3: } 4: public class Sub extends Super{ 5: 6: } 在第5行加入下列哪行代码后会导致程序编译错误 A: public float getNum(){return 4.0f;} B: public void getNum(){} C: public void getNum(double d){} D: public double getNum(float d){return 4.0d;}
- 给出以下代码,请问以下哪些语句放置在第六行会引起编译错误?( )1.class Super{2.public float getNum(){return 3.0f;}3.}4.5.public class Sub extends Super{6.7}请选择一个正确答案。 A: (1)public float getNum() {return 4.0f;} B: (2)public void getNum(){} C: (3) public void getNumdouble (){} D: (4)public double getNumfoat (){return 4.0d;}
- 将下列(A,B,C,D)哪个代码替换下列程序中的【代码】不会导致编译错误。(<br/>) A: public<br/>int f(){return 100+M;} B: int<br/>f(){return 100;} C: public<br/>double f(){return 2.6;}。 D: public<br/>abstract int f();<br/>interface Com {<br/>int M = 200;<br/>int f();}<br/>class ImpCom implements Com {<br/>【代码】}
- 有下面的类定义,与aMethod()重载的方法有?( )[br][/br]public class MyClass{[br][/br] public float aMethod(float a, float b){[br][/br]return 0;[br][/br]}[br][/br]}[br][/br] [br][/br](2.0) A: public int aMethod(int a, int b){} B: public float aMethod(float x, float y){} C: public float aMethod(float a , float b, int c){} D: public float aMethod(int a, int b, int c){} E: public void aMethod(float a, float b){}