public class StringReverse {
public static void main(String[] args) {
String str = "00nuhsnehc";
System.out.println(reverse(str));
}
public static String reverse(String str) {
if (str == null || str.trim().length() == 0) {
return "";
}
final String c = str.substring(0, 1);
final String substring = str.substring(1);
//递归取出前一个
String temp = reverse(substring);
return temp + c;
}
}