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

Rule:  StringandStringBuffer1Checked automatically with code checker

Synopsis:Don't use duplicate String literals; use constants instead
Language:Java
Severity Level:3
Category:StringandStringBuffer


Description:
Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
public class Foo {
 private void bar() {
    buz("Howdy");
    buz("Howdy");
    buz("Howdy");
    buz("Howdy");
 }
 private void buz(String x) {}
}