posted 10 years ago
I want to read information from a file, that contains information, structured like this:
2;Xbox 360;London;Black;Male;
1;Playstaion 3;Paris;Red;Female;
9;Playstaion 3;Moscow;White;Female;
I use ";" as delimiter for Scanner.. All the variables to store the tokens are Strings, except the first which is int type.
The problem is, that the first line is read with no problems, but immediately after the second one, I get inputMismatchException and if I try to System.out.println(ex.getMessage()); I get "null".
So I guess Scanner doesn't find the int, what could be the problem ?
Fixed the problem by adding sc.newLine() at the end of while loop