package Recursive;
import java.util.Scanner;
public class Exercise18_12 {
public static void main(String[] args) {
System.out.print("Enter a string: ");
String value = new Scanner(System.in).nextLine();
System.out.print("The reversion of " + value + " is ");
reverseDisplay(value);
}
/** 逆序打印字符 */
public static void reverseDisplay(String value) {
reverseDisplay(value, value.length());
}
/** 逆序打印字符辅助方法 */
private static void reverseDisplay(String value, int high) {
if (high > 0) {
System.out.print(value.charAt(high - 1));
reverseDisplay(value, high-1);
}
}
}