public class PassTest {
float ptValue;
public void changeInt(int value)
{
System.out.println("In changeInt:"+value);
value=55;
}
public void changeArrayValue(int xc[]){
System.out.println("In changeArrayValue:"+xc[1]);
xc[1]=6;
}
public static void main(String[] args) {
int val=11;
int sc[]={1,9};
PassTest pt=new PassTest();
pt.ptValue=20;
pt.changeInt(val);
System.out.println("Current Int value is: "+val);
pt.changeArrayValue(sc);
System.out.println("Current Value in array is: "+sc[1]);
}
}
结果
In changeInt:11
Current Int value is: 11
In changeArrayValue:9
Current Value in array is: 6