参数传递问题
public class PassTest {
/**
* 参数传递测试
*/
public int i =0;
public static void main(String[] args) {
int number1 = 0;
PassTest number2 = new PassTest();
PassTest number3 = new PassTest();
int[] number4 = {0};
test(number1, number2, number3, number4);
System.out.println("number1="+number1);
System.out.println("number2.i="+number2.i);
System.out.println("numbe3.i="+number3.i);
System.out.println("number[0]="+number4[0]);
}
public static void test(int number1,PassTest number2,PassTest number3
,int[] number4){
number1=1;
number2.i=1;
number3 = new PassTest();
number3.i=1;
number4[0]=1;
}
}
为什么打印结果是
number1=0
number2.i=1
numbe3.i=0
number4[0]=1
哪个大侠解释哈
[此贴子已经被作者于2007-3-28 21:17:30编辑过]