代码:
public class TestString {
String str = new String("good");
char [] ch = {'a','b','c'};
public static void main(String[] args) {
// TODO Auto-generated method stub
TestString ex = new TestString();
ex.change(ex.str,ex.ch);
System.out.println(ex.str+"and");
System.out.println(ex.ch);
}
public void change(String str2, char[] ch2) {
System.out.println("交换前:" + str2);
//result is the same
//str2 = new String("test ok");
str2 = "test ok";
System.out.println("交换后:" + str2);
ch[0] = 'g';
}
}
public class TestString {
String s