Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added exception

...

Code Block
bgColor#ccccff
private static final BigDecimal googol = BigDecimal.TEN.pow(100);
public static BigDecimal getGoogol() { return googol; }

Exceptions

Wiki Markup
*DCL31-J:EX1*: According to the Java Language Specification \[[JLS 05|AA. Java References#JLS 05]\], section 9.3 "Field (Constant) Declarations": "Every field declaration in the body of an interface is implicitly {{public}}, {{static}}, and {{final}}. It is permitted to redundantly specify any or all of these modifiers for such fields."

EX2: Constants declared using the enum type may violate this guideline.

Risk Assessment

Failing to declare mathematical constants static and final can lead to thread safety issues as well as inconsistent behavior.

...