While loop with case - getting error

I am trying to write a program that will ask the user how many classes they had for a semester. It proceeds to present the user with 5 options for the grade they received A,B,C,D,F. What I am trying to do is a while loop that counts down while the user inputs his grades for the number of classes he/she took that semester. I am able to compile the code but when I type in how many classes in the semester I receive the error " Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out o range: 0 at java.land.String.CharAt<Unknown Source> at GPA.main<GPA.java:38> Any help would be awesome and it is deeply appreciated.

You have fallen foul of the Scanner.nextInt problem. If user enters 48<enter> then the nextInt method only reads the 48 and leaves the carriage return in the buffer. No what you have to remember is that there is a String between the 8 and the carriage return, it just happens to be an empty String or a String with a length of 0. So when you call nextLine it returns that empty String to your choice variable. Of course then trying to extract the char at position 0 will throw the exception becuase it does not exist.

Quick and dirty solution call nextLine and throw it away immediately after the call to nextInt.