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

Rule:  StringandStringBuffer7Checked automatically with code checker

Synopsis:Avoid appending characters as strings in StringBuffer.append
Language:Java
Severity Level:5
Category:StringandStringBuffer


Description:
Avoid concatenating characters as strings in StringBuffer.append.
public class Foo {
 void bar() {
  StringBuffer sb=new StringBuffer();
  // Avoid this
  sb.append("a");

  // use instead something like this
  StringBuffer sb=new StringBuffer();
  sb.append('a');
 }
}