TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  StringandStringBuffer12Checked automatically with code checker

Synopsis:No need to call String.valueOf to append to a string
Language:Java
Severity Level:3
Category:StringandStringBuffer


Description:
No need to call String.valueOf to append to a string; just use the valueOf() argument directly.
public String convert(int i) {
  String s;
  s = "a" + String.valueOf(i); // Bad
  s = "a" + i; // Better
  return s;
}