Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot (vkp) v1.0

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 2008|AA. Java References#PughBibliography#Pugh 08]\].

Noncompliant Code Example

...

Wiki Markup
\[[API 2006|AA. Java References#APIBibliography#API 06]\] Class {{InputStream}}
\[[JLS 2005|AA. Java References#JLSBibliography#JLS 05]\] 4.2 Primitive Types and Values
\[[Pugh 2008|AA. Java References#PughBibliography#Pugh 08]\] "Waiting for the end"

...