题目内容

(1+X)以下使用 test() 方法的代码,哪一个是正确的( )?public int test(int num, String str){return num+ Integer.parseInt(str);}

A. test( "1", 2);
B. test();
C. test(1);
D. test(1,"2");

查看答案
更多问题

(专升本)类定义中可以定义构造方法,它是一类特殊的方法,定义类的构造方法的条件错误的是( )

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)

答案查题题库