题目内容

正确的方法定义是()。

A. int method(int a,b) {return (a - b);}
B. double method(int a, int b){int w; w = a - b;}
C. double method(a,b){return b;}
D. int method(int a, int b){return a - b;}

查看答案
更多问题

在下列方法定义中,方法头不正确的是()。

A. public int method( ){...}
B. public static int method(double y){...}
C. void method(double d){...}
D. public static method(double a){...}

()是作为void getSort(int x)方法的重载方法。

A. public getSort(float x)
B. int getSort(int y)
C. double getSort(int x, int y)
D. void get(int x, int y)

()不能作为void sort(int x)方法的重载方法。

A. public float sort(float x)
B. int sort(int y)
C. double sort(int x, int y)
D. void sort(double y)

为了区分重载方法,要求()。

A. 采用不同的形式参数列表
B. 返回值类型不同
C. 调用时用类名或对象名做前缀
D. 参数名不同

答案查题题库