public class Test1{
public static void main(String[] args){
StringBuffer s=new StringBuffer("abcde");
reverseString(s);
System.out.println(s);
}
public static int reverseString(StringBuffer s){
StringBuffer s1=new StringBuffer("");
int length=s.length();
for(int i=length-1;i>=0;i--){
s1.append(s.charAt(i));
}
s=s1;
return 1;
}
}
我想更改StringBuffer。在方法中,s =“edcba”,但我运行类,结果是“abcde”。为什么?