(专升本)类定义中可以定义构造方法,它是一类特殊的方法,定义类的构造方法的条件错误的是( )
A. 参数列表必须为空
B. 没有返回值
C. 名字应该与类名相同
D. 构造方法可以重载
查看答案
正确的方法定义是()。
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)