Analyze the following code.
public class Test {
public static void main(String[] args) {
int n = 2;
xMethod(n);
System.out.println("n is " + n);
}
void xMethod(int n) {
n++;
}
}
发布于 2021-02-15 03:24:32
【单选题】 A The code has a compile error because xMethod does not return a value B The code has a compile error because xMethod is not declared static C The code prints n is 2 D The code prints n is 3