我正在评估一个练习题,我只是想知道程序如何得出答案---> 2 1 我很难理解主要驱动程序呼叫。我了解这些方法的用法。需要帮助了解程序执行情况
的代码是:
public class Test {
public static void main(String[] args) {
int[] x = {1, 2, 3, 4, 5};
increase(x);
int[] y = {1, 2, 3, 4, 5};
increase(y[0]);
System.out.println(x[0] + " " + y[0]);
}
public static void increase(int[] x) {
for (int i = 0; i < x.length; i++)
x[i]++;
}
public static void increase(int y) {
y++;
}
}
研究变量的范围并传递值。 – 2013-05-09 18:11:52
向我们解释你所知道的以及你认为它应该如何工作。 – 2013-05-09 18:11:54