next up previous
Next: 1.3.7 Java Types and Up: 1.3 Java Notation and Previous: 1.3.5 Variations on the

1.3.6 Capitalization Conventions

Java programs are written entirely in lower case characters with two exceptions. First, the first letter of class names are capitalized to distinguish class names from member names. Second the first letter in each word in a compound identifier after the first are capitalized. For example, the built-in Java class Object includes a method called toString() that we will discuss later. The capital ``S'' signifies the beginning of a word within the compound name toString().

These conventions are not enforced by Java compilers, but it is considered very bad style to violate them. A related convention is to never use the special character $ in a name; this character is reserved for the use of the Java compiler. Unfortunately, most Java compilers do not enforce this convention.

Java relies on commenting commenting conventions similar to those in C++. A comment that is confined to a single line begins with the character sequence // and ends at the end of the line. Longer comments must be enclosed between the opening ``bracket'' /* and ``closing'' bracket */. Examples of both form of comments appear in Section 1.4.


next up previous
Next: 1.3.7 Java Types and Up: 1.3 Java Notation and Previous: 1.3.5 Variations on the
Robert Cartwright, Spring 1999