public class RecurseReverse{
public static String reverse(String s){
String rval;
Trace.reverseIndent(s.length(),
"entering reverse("+s+")");
if (s.length()<=1)
rval=s;
else
rval=reverse(s.substring(1))+s.charAt(0);
Trace.reverseIndent(s.length(),
"reverse("+s+")="+rval);
return rval;
}
public static void main(String [] args){
System.out.println(reverse("scoobydoo"));
}
}
//