Java Reference
In-Depth Information
The Java Keywords
combined with the syntax of the operators and separators, form the definition of the Java
language. These keywords cannot be used as names for a variable, class, or method.
Table 1-1
The Java Keywords
The keywords
const
and
goto
are reserved but not used. In the early days of Java, several
other keywords were reserved for possible future use. However, the current specification
for Java defines only the keywords shown in
Table 1-1
.
In addition to the keywords, Java reserves the following:
true
,
false
, and
null
. These are
values defined by Java. You may not use these words for the names of variables, classes,
and so on.
Identifiers in Java
In Java an identifier is a name given to a method, a variable, or any other user-defined item.
Identifiers can be from one to several characters long. Variable names may start with any
letter of the alphabet, an underscore, or a dollar sign. Next may be either a letter, a digit,
a dollar sign, or an underscore. The underscore can be used to enhance the readability of
a variable name, as in
line_count
. Uppercase and lowercase are different; that is, to Java,
myvar
and
MyVar
are separate names. Here are some examples of acceptable identifiers: