Saturday, May 7, 2011

JAVA IDENTIFIERS

Every programming language has its rules for how to name elements of a program. In Java, names must
always begin with a letter. Letters in Java include all lowercase and uppercase letters, as well as the underscore
character “_” and the currency symbol “$”.
After the first letter, any number of letters and/or digits may follow. A Java identifier may be of any length,
and it is good programming practice to use names long enough to be self-descriptive. More experienced
programmers generally use longer variable names, because longer names usually make programs much easier
to read and maintain.
Java is a “case-sensitive” language. That means that Java recognizes uppercase and lowercase letters as
different. The identifier university is different from University, and both are different from
UNIVERSITY.
While one is not required to do so, standard programming practice is to begin all class names with an
uppercase letter, and to begin all other names with a lowercase letter. Also, when an identifier consists of more
than one word, the usual practice is to use what’s called “camel case” capitalization (it’s “humpy”). Here are
some example variable names:
highWindWarning
wonLostRecord
mothersMaidenName

No comments:

Post a Comment