下面不能与int sum(int a, int b);构成函数重载的是()?
A: int sum(int a, int b, int c);
B: int sum(int a, float b);
C: int sum(float a, float b);
D: float sum(int a, int b);
A: int sum(int a, int b, int c);
B: int sum(int a, float b);
C: int sum(float a, float b);
D: float sum(int a, int b);
举一反三
- 下面不正确的函数重载是( ) A: int sum(int a,int b);int sum(float a,float b); B: int sum(int a,int b);int sum(int a,int b,int c); C: int sum(int a,int b);int sum(int a,int b,int c=0); D: int sum(int a,int b);float sum(int a,int b); E: int sum(int a,int b);int sum(float a,float b);
- 在某个类中存在一个方法:void sum(int x , int y),以下不能作为该方法重载声明的是( )。 A: float sum(float x, float y) B: int sum (int y) C: double sum (int x,int y) D: void sum (double y)
- 请阅读下面的程序public class Demo { public static int sum(int a, int b) { return a + b; } public static float sum(int a, ____ b) { _____ a + b; }}
- 下面的函数声明,( )是void fun(int a,int b);的重载函数。 A: void fun(int a,int b); B: int fun(int ,int ); C: float fun(int a,int b); D: void fun(float x,float y,float z);
- 请阅读下面的程序 public class Demo { public static void sum(int a, int b) { System.out.println("int:" + (a + b)); } public static void sum(int a, float b) { System.out.println("float:" + (a + b)); } public static void sum(int a, double b) { System.out.println("double:" + (a + b)); } public static void main(String[] args) { int a = 10; long b = 20; sum(a, b); } } 下列选项中,哪一个是程序的运行结果()