Wiki Markup |
---|
The {{char}} type is the only unsigned primitive type in Java. As a result, a signed value cannot be stored and retrieved successfully from a variable of type {{char}}. In particular, comparing a value of type {{char}} with -1 will never yield {{true}}. However, because the method {{read()}} returns -1 to indicate the End of File ({{EOF}}) condition, it is tempting to compare the character returned by {{read()}} with -1. This is a common error \[[Pugh 082008|AA. Java References#Pugh 08]\]. |
...
References
Wiki Markup |
---|
\[[API 062006|AA. Java References#API 06]\] Class {{InputStream}} \[[JLS 052005|AA. Java References#JLS 05]\] 4.2 Primitive Types and Values \[[Pugh 082008|AA. Java References#Pugh 08]\] "Waiting for the end" |
...