Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: reordered some text in intro

...

Do not use multiple identifiers that vary by only one or more visually similar characters. Also, make the initial portions of long identifiers distinct to aid recognition.

Use L, not l, to clarify programmer intent when indicating that an integer literal is of type long.

According to the Java Language Specification, §3.10.1, "Integer Literals" [JLS 2011],

An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise, it is of type int. The suffix L is preferred because the letter l (ell) is often hard to distinguish from the digit 1 (one).

Consequently, use L, not l, to clarify programmer intent when indicating that an integer literal is of type long.

Integer literals with leading zeros, in actuality, assume octal values, not decimal values. According to §3.10.1, "Integer Literals," of the Java Language Specification [JLS 2011],

An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 interspersed with underscores, and can represent a positive, zero, or negative integer.

Integer literals with leading zeros, in actuality, assume octal values, not decimal values. This misinterpretation may result in programming errors and is more likely to occur while declaring multiple constants and trying to enhance the formatting with zero padding.

...