Java ignores EOF while reading chars from file
<p>I try to read a File char by char. Unfortunately Java ignores EOF while reading chars from file. </p>

<pre><code>FileReader fileReader = new FileReader(fileText);
char c;
String word = "";
List&lt;String&gt; words = new ArrayList&lt;String&gt;();

while ((c = (char) fileReader.read()) != -1) {
    System.out.println(c);
    if (c != ' ') {
        word = word + c;
    }
    else {
        words.add(word + " ");
        word = "";
    }
}
</code></pre>

<p>It should break up after the file is read, but instead it never stops running.... </p>
