public class Test{
String str=new String("good");
char[] ch={'a','b','c'};
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
public static void main(String args[]){
Test t=new Test();
System.out.println(t.str);
t.change(t.str,t.ch);
System.out.print(t.str+"and");
System.out.print(t.ch);
}
}
结果是goodandgbc,而不是test okandgbc,
有点不懂了
|