public class T { //反转字符串 public static String reverseString(String s){ if(s.isEmpty()) return s; return reverseString(s.substring(1))+s.charAt(0); } public static void main(String[] args) { System.out.println(reverseString("123456789")); } }
public class T { //反转字符串 public static String reverseString(String s){ if(s.isEmpty()) return s; return reverseString(s.substring(1))+s.charAt(0); } public static void main(String[] args) { System.out.println(reverseString("123456789")); } }