Wednesday, 23 November 2011

Java keywords and identifiers

Keywords are reserved words that are predefined in the language; see the table below. All the keywords are in lowercase.

Note: assert is a new keyword since J2SE 1.4

An identifier is composed of a sequence of characters where each character can be a letter, a digit, an underscore, or a dollar sign.

An identifier declared by the programmer cannot be a Java keyword and it cannot start with a digit. For instance:

number, $$abc, _xyx            // Legal Identifiers
12cc, ss-he                              // Illegal identifiers


Ranges of primitive types

The size and range of all primitive types are listed in the table below. The positive range is one less than the negative range because zero is stored as a positive number. For the boolean datatype, there is no range; it can only be true or false.

No comments:

Post a Comment