I should confess,your imagination about recursion is so bad.I recommend to read some tutorials
|
Code:
|
public static String reverse (String s)
{
if (s.length() <= 1)
{
return s; // stopping case
}
else
{
return reverse(s.substring(1)) + s.charAt(0); // recursion
}
} |
I don't understand where you got some variables,your stopping case is really awful,and of course you have no any return statement,OMG those are the base things.