public class Test1 {
public static void main(String[] args) {
String x= reverseStr1("abcdefg");
System.out.println(x);
}
public static String reverseStr1(String x)
{
if(x==null || x.length()<2)
return x;
return reverseStr1(x.substring(1))+x.charAt(0);
}
}
3、字符串逆转 递归
于 2022-12-15 15:08:24 首次发布