I was tasked to make a program that took a string input, then reversed it using recursion. I'm getting a syntax error causing an exit code 1. Also, I'm sure there may be an error in the code as I'm not very strong with recursion. Any help with this (specifically this obnoxious syntax error which I can't seem to find) would be very helpful!
/**
This program takes a string input and
reverses is using recursion, then
outputs it
*/
import java.util.Scanner;
import java.util.*;
public class StringReverser
{
public static void main(String[] args)
{
String input;
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter a string to be reversed: ");
input = keyboard.nextLine;
reverse(input);
}
public static String reverse(String str)
{
if((null == str) || (str.length() <= 1))
{
return str;
}
return reverse(str.substring(1)) + str.charAt(0);
}
}