public class PassTest{
float ptValue;
public static void main(String args[]){
String str;
int val;
PassTest pt=new PassTest();
val=11;
pt.changeInt(val);
System.out.println("Int value is:"+val);
str=new String("Hello");
pt.changeStr(str);
System.out.println(Str value is:"+str);
pt.ptValue=101f;
pt.changeObiValue(pt);
System.out.println("Current ptValue is:"+pt.ptValue);
}
public void changeInt(int value){
value=55;
}
public void changeStr(String value){
value=new String("different")
}
public void changeObjValue(PassTest ref)
ref.ptValue=99f;
}
}
260

被折叠的 条评论
为什么被折叠?



