Ok it definitely is not finding the first line in the file. I simply removed the test for the first line and it chocked up and died a spectacular java ioexception death. The Players.txt file is in the same directory so I'm not sure why it can't find the first line.
I'd be willing to bet that if you changed your code to this, then your code would work. I've never actually seen somebody use "File" as an argument to a Scanner, so excuse me if I'm wrong, but I don't think it should be used. File is a class that represents a File, is it not? A File and a FileInputStream are not the same thing, I don't think. Try this..
Scanner whatever = new Scanner(new FileInputStream(yourFileHere));
> for some reason the file doesn't start with a eof character does it?
EOF isn't a character, this is one of the reasons why the read method in Java and the getchar / fgetc function in C returns an int instead of a char [hint: since char is unsigned, there would be no way of differentiating between a valid character and an EOF being reached]. An EOF is signaled when no more bytes could be read from the underlying stream / file. EOFException , -1 and null are some of the ways used to signal an EOF in Java.
In my experience, hasNextLine( ) goes crazy when the Scanner is created with new Scanner (new File(...)) and there are non-ascii characters in the file (such as á, ñ, ..). As suggested, by creating the Scanner new Scanner (new FileInputStream(...)) the problem disappears.
A quick look at the source code for Scanner shows that the File constructor immdiately creates a FileInputStream from the file and proceeds with that, so just passing the stream rather than the file shouldn't make any difference.
Problems with non-ascii chars are much more likely to be a problem with the default charset not matching the actual file contents. The best practice is always to specify the appropriate charset in the constructor call.
It's just another example of why Scanner is a total fail as a quick solution for novices (eg getting the next line after geting an integer).
You may find this amusing