I have to use recursion for this problem, I managed to make it work using loops pretty quickly but I'm a bit stuck on this. My current code is
public static String ReverseR(String n){
String finalstring="";
int i = 0;
int len = n.length();
while (i < len) {
finalstring += (n.charAt(len - 1));
ReverseR(n.substring(0, len - 1));
i++;
}
return finalstring;
}
When I input any string, the resulting string is the correct length, but only uses the last letter. Ex: ReverseR("Hello") = ooooo Any ideas?