2021-04-28 16:49:39 +02:00
|
|
|
Appending ``++String.valueOf()++`` to a ``++String++`` decreases the code readability.
|
|
|
|
|
|
|
|
The argument passed to ``++String.valueOf()++`` should be directly appended instead.
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
public void display(int i){
|
|
|
|
System.out.println("Output is " + String.valueOf(i)); // Noncompliant
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
public void display(int i){
|
|
|
|
System.out.println("Output is " + i); // Compliant
|
|
|
|
}
|
|
|
|
----
|