import java.util.Scanner; public class Test_A15 { public static void main(String[] args){ String strA=""; System.out.println("请输入一串字符串:"); Scanner scanner=new Scanner(System.in); strA=scanner.next(); Test_A15 T15=new Test_A15(); String reversedStr =T15.chartA1(strA); System.out.println("反转后的字符串是:"+reversedStr); } public String chartA1(String aa){ String str1=""; for(int i=aa.length()-1;i>0;i--){ str1+=aa.charAt(i); } return str1; } }