给出如下代码:class Test{ private int m; public static void fun() { // some code... } } 如何使成员变量m 在方法fun()中直接访问? ()
A.将private int m 改为protected int m
B.将private int m 改为public int m
C.将private int m 改为static int m
D.将private int m 改为int m
A.将private int m 改为protected int m
B.将private int m 改为public int m
C.将private int m 改为static int m
D.将private int m 改为int m
A、将privateintm改为protectedintm
B、将privateintm改为publicintm
C、将privateintm改为staticintm
D、将privateintm改为intm
A、编译通过,输出: 此行将无法被执行!
B、编译通过,输出: 此行将无法被执行! exception: 数组下标不能为负数。
C、编译通过,输出: exception: 数组下标不能为负数。
D、编译不能通过
public class Test {
void printValue(int m) {
do { System.out.println("The value is"+m);
}
while(--m >10 )
}
public static void main(String arg[]) {
int i=10;
Test t= new Test ();
t.printValue(i) ;
}
}
Which will be output?
A.The value is 8 B.The value is 9
C.The value is 10 D.The value is 11
1)class Person {
2) public void printValue(int i, int j) {/*…*/ }
3) public void printValue(int i) {/*…*/
4) }
5) public class Teacher extends Person {
6) public void printValue() {/*…*/ }
7) public void printValue(int i) {/*…*/}
8) public static void main(String args[]) {
9) Person t = new Teacher();
10) t.printValue(10) ;
11)}
12)}
Which method will the statement on line 10 call?
A.on line 2 B.on line 3
C.on line 6 D.on line 7
A、null null 42
B、0 42 42
C、0 0 0
D、编译出错
A.1 0
B.20
C.25
D.30
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!