Java Programming Style Guide

Variable Naming Conventions

Choose meaningful names that describe what the variable is being used for. Avoid generic names like number or temp whose purpose is unclear.

Compose variable names using mixed case letters starting with a lower case letter. For example, use salesOrder rather than SalesOrder or sales_order.

Use plural names for arrays. For example, use testScores instead of testScore.

Exception: for loop counter variables are often named simply i, j, or k, and declared local to the for loop whenever possible.

for (int i = 0; i < MAX_TEMPERATURE; i++)
{
   boilingPoint = boilingPoint + 1;
}

Rationale:

These conventions are common practice in the Java development community as well as the naming convention for variables used by Sun for the Java core packages. Writing code that follows these conventions makes variables easy for others to distinguish from other types.

Declaring and commenting local variables