...
In this noncompliant code example, the value of type int returned by the read() method is cast directly to a value of type char which is compared with -1 to try to detect EOF. This conversion leaves the value of c as 0xffff (Character.MAX_VALUE) instead of -1. HenceAs a result, this test never evaluates to true.
...