I am having a bit of a problem here. I am trying to reverse a user inputted string using recursion, but I keep getting an error. Basically, a parameterless void, recursive function should be called to print out the string backwards. I get an error on the 23rd line only under the reverse word, which states "The method reverse() in the type RecursionReversal is not applicable for the arguments (String)". There are quick fixes to it given in Eclipse, but none of them are what I need. Am I missing something?
import java.util.Scanner;
public class RecursionReversal
{
public static String origChars;
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Please enter 5 characters:");
origChars= input.nextLine();
reverse();
}
public static void reverse()
{
if(origChars.length() <= 1)
return;
else
reverse(origChars.substring(1) + origChars.charAt(0));
}
}