在定义一个类的时候,如果类的成员被private所修饰,则该成员不能在类的外部被直接访问。
查看答案
(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){...}