import java.util.Scanner;
//编写程序,将键盘录入的字符串倒序打印,并测试
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个字符串");
String s = sc.nextLine();
char[] ch = s.toCharArray();
for (int i =ch.length-1; i>=0 ; i--) {
System.out.print(ch[i]);
}
}
} |