下面的方法是在类中定义的重载的方法,哪几组是正确的重载方法?
A: method1(int a);method1(float a);
B: method2(int a);method2(int a, int b);
C: method3(string name, double score);method3(int id, double score);
D: method4(string name, double score);method4(string id, double credit);
A: method1(int a);method1(float a);
B: method2(int a);method2(int a, int b);
C: method3(string name, double score);method3(int id, double score);
D: method4(string name, double score);method4(string id, double credit);
举一反三
- 在下列方法定义中,方法头不正确的是( )。 A: public int method( ){...} B: public static int method(double y){...} C: void method(double d){...} D: public static method(double a){...}
- 下面那几个函数是public void method(){̷}的重载函数? A: public void method( int m){} B: public int method(){} C: public void method2(){} D: public int method(int m,float f ){}
- }的重载函数? A: A public void method( int m){...} B: B public int method(){...} C: C public void method2(){...} D: D public int method(int m,float E: f ){...}
- 在下面的类中,合法重载的方法是( ) public class Q1{ public void method(int i){} } A: private void method(int i){} B: public void method(int k){} C: public int method(int i){} D: private float method(float f){}
- 下面( )代码正确的声明了一个类方法(静态方法)。 A: public int method(int i) B: protected method(int i) C: public static method(String s) D: protected static void method(Integer i)