How do I fix an InputMismatchException error that comes from scanner incorrectly reading a file?
问题 I am trying to simply read the first thing in a file and set a variable to hold that value. The first line of the file is 10 (see below) and I am using .nextInt() to try to read the value but I am getting this error message: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:864) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at project5.Project5