-->
当前位置:首页 > 题库

单选题:以下代码的输出结果为( )。

Luz5年前 (2021-05-10)题库3475
以下代码的输出结果为( )。 @[C](2)

public class Pass{
static int j = 20;
public void amethod(int x){
x = x*2;
j = j*2;
}
public static void main(String args[]){
int i = 10;
Pass p = new Pass();
p.amethod(i);
System.out.println(i+" and "+j);
}
}
A. 错误:方法参数与变量不匹配
B. 20 and 40
C. 10 and 40
D. 10 and 20



A.错误:方法参数与变量不匹配
B.20 and 40
C.10 and 40
D.10 and 20


答案:C