> 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.