/*
Java中的参数传递问题
*/
class ArrayTest6 {
public static void main(String[] args) {
int a = 5;
int b = 3;
System.out.println("a="+a+",b="+b);
change(a, b);
System.out.println("a="+a+",b="+b);
int[] arr = {1,2,3,4,5};
change(arr);
System.out.println(arr[0]);
}
public static void change(int x, int y){
x=100;
y=200;
}
public static int change(int[] arr){
for (int i=0; i<arr.length; i++) {
arr[i] *= 2;
}
}
}
|
|