public class Main
{
String str=new String("good");
char[] ch={'a','b','c'};
public static void main(String[] args) {
Main m=new Main();
m.change(m.str, m.ch);
System.out.print(m.str+" and ");
System.out.print(m.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
輸出結果:
good and gbc
求大神解釋,越詳細越好~!謝謝!
為什麼不是
test ok and gbc
http://blog.csdn.net/wuwenxiang91322/article/details/17038557