String str = new String("good");
char[] ch = {'a','b','c'};
public static void main(String[] args) {
Test te = new Test();
te.change(te.str,te.ch);
System.out.println(te.str + "and");
System.out.println(te.ch);
}
public static void change(String str, char ch[]){
str = "test ok";
ch[0] = 'g';
}
为什么数组下标0的数据会被更改 |
|