next up previous
Next: About this document ... Up: 4.3 Java Statements Previous: 4.3 Java Statements

4.3.1 Variable Names and Type Names

Java variable names and type names must be identifiers. An identifier is any sequence of ``alphanumeric characters'' (letters, digits, and _) beginning with a letter or _--except for the following keywords, which are reserved and may not be used as variable names or type names:
abstract    default     if          private     throw
boolean     do          implements  protected   throws
break       double      import      public      transient
byte        else        instanceof  return      try
case        extends     int         short       void
catch       final       interface   static      volatile
char        finally     long        super       while
class       float       native      switch
const       for         new         synchronized
continue    goto        package     this
Java is case-sensitive; the variable X is distinct from the variable x. There are three kinds of variables in Java: fields, method parameters, and local variables. Fields and method parameters are discussed in detail in the next subsection. We will defer a discussion of local variables until Section 1.9.1.



Corky Cartwright 2003-07-07