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

Rule:  Basic9Checked automatically with code checker

Synopsis:Avoid unnecessary temporaries when converting primitives to Strings
Language:Java
Severity Level:3
Category:Basic


Description:
Avoid unnecessary temporaries when converting primitives to Strings
public String convert(int x) {
  // this wastes an object
  String foo = new Integer(x).toString();
  // this is better
  return Integer.toString(x);
}