...
Code Block | ||
---|---|---|
| ||
strictfp class Example { public static void main(String[] args) { double d = Double.MAX_VALUE; System.out.println("This value \"" + ((d * 1.11d) / 1.11d) + "\" cannot be represented as double."); } } |
Note that this compliant solution also specifies that the floating point literals are of type double to clarify their expected type; this complies with guideline NUM18-J. Be aware of numeric promotion behavior.
Noncompliant Code Example
...