Files
openide/java/java-impl/resources/inspectionDescriptions/NumericToString.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

20 lines
650 B
HTML

<html>
<body>
Reports <code>toString()</code> calls on objects of a class extending <code>Number</code>.
Such calls are usually incorrect in an internationalized environment and some locale specific formatting should be used instead.
<p><b>Example:</b></p>
<pre><code>
void print(Double d) {
System.out.println(d.toString());
}
</code></pre>
A possible way to fix this problem could be:
<pre><code>
void print(Double d) {
System.out.printf("%f%n", d);
}
</code></pre>
This formats the number using the default locale which is set during the startup of the JVM and is based on the host environment.
<!-- tooltip end -->
</body>
</html>