I am a novice Java student and am trying to complete a program that uses the scanner to input 5 students\' names, and then a loop within to get 3 grades for each student. I am
From the docs:
Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.
From your stack trace:
Exception at thread "main" java.util.InputMismatchException
at java.util.Scanner.throwfor{Scanner.java:909}
at java.util.Scanner.next{Scanner.java:1530}
at java.util.Scanner.nextInt{Scanner.java:2160}
at java.util.Scanner.nextInt{Scanner.java:2119}
at StudentGrades.main{StudentGrades.java:20}
the Exception is being thrown by your call to nextInt
.
Thus, you're getting an exception because you're requesting an integer and the Scanner is finding something that's not an integer.