Java Reference
In-Depth Information
the 8-bit ISO Latin-1 character set, which is useful only for major Western European
languages, the Unicode character set can represent virtually every written language
in common use on the planet.
If you do not use a Unicode-enabled text editor, or if you do
not want to force other programmers who view or edit your
code to use a Unicode-enabled editor, you can embed Unicode
characters into your Java programs using the special Unicode
escape sequence \u xxxx , in other words, a backslash and a
lowercase u, followed by four hexadecimal characters. For
example, \u0020 is the space character, and \u03c0 is the
character π.
a x
Java has invested a large amount of time and engineering effort in ensuring that its
Unicode support is first class. If your business application needs to deal with global
users, especially in non-Western markets, then the Java platform is a great choice.
Case Sensitivity and Whitespace
Java is a case-sensitive language. Its keywords are written in lowercase and must
always be used that way. That is, While and WHILE are not the same as the while
keyword. Similarly, if you declare a variable named i in your program, you may not
refer to it as I .
In general, relying on case sensitivity to distinguish identifiers
is a terrible idea. Do not use it in your own code, and in par‐
ticular never give an identifier the same name as a keyword
but differently cased.
Java ignores spaces, tabs, newlines, and other whitespace, except when it appears
within quoted characters and string literals. Programmers typically use whitespace
to format and indent their code for easy readability, and you will see common
indentation conventions in the code examples of this topic.
Comments
Comments are natural-language text intended for human readers of a program.
They are ignored by the Java compiler. Java supports three types of comments. The
first type is a single-line comment, which begins with the characters // and contin‐
ues until the end of the current line. For example:
int i = 0 ; // Initialize the loop variable
The second kind of comment is a multiline comment. It begins with the charac‐
ters /* and continues, over any number of lines, until the characters */ . Any text
between the /* and the */ is ignored by javac . Although this style of comment is
typically used for multiline comments, it can also be used for single-line comments.
Search WWH ::




Custom Search