package com.test;
public class Test {
public static void main(String[] args) {
String str = "abcde";
char[] chars = str.toCharArray();
int length = chars.length;
for(int i = 0; i < length/2; i++) {
//交换位置
char temp = chars[i];
chars[i] = chars[length - 1 - i];
chars[length - 1 - i] = temp;
}
String newStr = new String(chars);
System.out.println(newStr);
}
}