I am a relative beginner to Java and am having an issue with a user controlled do-while loop that accepts user input to repeat. Here is the code at the end of the loop.
System.out.print("Do you wish to continue? (Y for yes " +
"/ N for no)");
input = keyboard.nextLine();
input.length();
repeat = input.charAt(0);
}while (repeat == 'Y' | repeat == 'y');
I know it's throwing the exception because of the value, but can't figure out what to do to fix it, as I'm sure it's relatively simple. Thanks for the help.
Edit 1: Stacktrace:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException:
String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at FractionTest.main(FractionTest.java:59)