Java递归实现字符串的倒序输出
public
static
String reverse(String s) {
if
(s ==
null
) {
return
s;
}
int
i = s.indexOf(
" "
);
if
(i == -
1
) {
return
s;
}
return
reverse(s.substring(i +
1
)) +
" "
+ s.substring(
0
, i);
}