类Test定义如下,将下列哪个方法插入③行处是不合法的?   ① public class Test {   ②   public float Method(float a,float b) { }   ③   ④ }

admin2009-01-15  27

问题 类Test定义如下,将下列哪个方法插入③行处是不合法的?   ① public class Test {   ②   public float Method(float a,float b) { }   ③   ④ }

选项 A、public float Method(float a,float b,float c) { }
B、public float Method(float c,float d){ }
C、public int Method(int a,int b){  }
D、private float Method(int a,int b,int c){ }

答案2

解析 此题主要考查方法重载,方法的重载是指多个方法可以享有相同
的名字,但参数的数量或类型必须不相同(采用不同的形式参数列表)。选项B)不符合
方法重载的要求。
转载请注明原文地址:https://jikaoti.com/ti/HKb0FFFM
0

相关试题推荐
最新回复(0)