Java Reference
In-Depth Information
For example, the raw input \u005cu005a results in the six characters \ u 0 0 5 a , because
005c is the Unicode value for \ . It does not result in the character Z, which is Unicode
character 005a , because the \ that resulted from the \u005c is not interpreted as the start
of a further Unicode escape.
The Java programming language specifies a standard way of transforming a program writ-
ten in Unicode into ASCII that changes a program into a form that can be processed by
ASCII-based tools. The transformation involves converting any Unicode escapes in the
source text of the program to ASCII by adding an extra u - for example, \u xxxx becomes
\uu xxxx - while simultaneously converting non-ASCII characters in the source text to
Unicode escapes containing a single u each.
This transformed version is equally acceptable to a Java compiler and represents the exact
same program. The exact Unicode source can later be restored from this ASCII form by
converting each escape sequence where multiple u 's are present to a sequence of Unicode
characters with one fewer u , while simultaneously converting each escape sequence with a
single u to the corresponding single Unicode character.
A Java compiler should use the \u xxxx notation as an output format to display Unicode
characters when a suitable font is not available.
3.4. Line Terminators
A Java compiler next divides the sequence of Unicode input characters into lines by recog-
nizing line terminators .
LineTerminator:
the ASCII LF character, also known as "newline"
the ASCII CR character, also known as "return"
the ASCII CR character followed by the ASCII LF character
InputCharacter:
UnicodeInputCharacter but not CR or LF
Lines are terminated by the ASCII characters CR, or LF, or CR LF. The two characters CR
immediately followed by LF are counted as one line terminator, not two.
A line terminator specifies the termination of the // form of a comment (ยง 3.7 ) .
The lines defined by line terminators may determine the line numbers produced by a
Java compiler.
Search WWH ::




Custom Search