public class Test {
public char[] reverse(String list) {
char[] ch=list.toCharArray() ;
for (int i = 0, j = list.length() - 1; i < j; i++, j--) {
char temp=ch[i];
ch[i]=ch[j];
ch[j]=temp;
}
return ch;
}
public static void main(String args[]) {
Test test = new Test();
String a="HELLo";
char[] b=test.reverse(a);
System.out.println(a);
System.out.println(b);
System.out.println(a+b);
}
}
输出: 你好 2009东海生日贺 HELLO [C @ 38462f90
最后s.o.p输出是参考,而对于第二个s.o.p中的相同可变b,是字符串值。请解释原因