Choose meaningful names that describe what the variable is being
used for. Avoid generic names like number
or x 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.
Exception: for
loop counter variables
are often named simply i, j, or k,
and declared local to the for
loop whenever possible.
for (inti= 0;i< MAX_TEMPERATURE;i++)
{
boilingPoint = boilingPoint + 1;
}
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.