I am having trouble with my program. I finished it but, I can not get the begging to cooperate. I need to take a users input if they would like to play a game. I have to use the charAt method to take the first character of their input and if it is a N or n then the program ends. Otherwise it continues. It works but, if the enter key is pressed then the program crashes and I receive the Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:687)
at Ex2.main(Ex2.java:21)
Can anyone help me correct this? I have to us charAt
Here is my code (just the part where I am having issues)