输入一行字符串,然后反转输出来
Scanner sc = new Scanner(System.in);
System.out.println("请输入你要反转的字符串:");
String line = sc.nextLine();
//将字符串先转换成字符数组
char[] arr = line.toCharArray();
String str = "";
for(int i = arr.length()-1;i>=;i--){
str = str + arr[i];
}
System.out.println(str);