...
Code that depends on implementation-defined behavior is non-portable. In the unusual case where a program is guaranteed to execute only on a single implementation, it is permissible to depend on implementation-specific ranges of memoized values.
Noncompliant Code Example
...
Code Block | ||
---|---|---|
| ||
public void exampleEqualOperator(){ Boolean b1 = true; // Or Boolean.True Boolean b2 = true; // Or Boolean.True if (b1 == b2) { // always equal System.out.println("Always print"); } } |
Exceptions
...
Risk Assessment
Using the equivalence operators to compare values of boxed primitives can lead to erroneous comparisons.
...