示例

public static void main(String[] args){
System.out.println( "Hello" ); //$NON-NLS-1$
System.out.println( "Bye" ); //$NON-NLS-1$
System.out.println( "Hello" ); //$NON-NLS-1$
}

解决方案
声明常量
  1. 声明表示字符串文字的常量并对其指定有意义的名称。
  2. 将该字符串文字的所有出现替换为对所声明常量的引用。

public static void main(String[] args) {
System.out.println( HELLO );
System.out.println( BYE );
System.out.println( HELLO );
}

private static final String HELLO = "Hello"; //$NON-NLS-1$
private static final String BYE = "Bye"; //$NON-NLS-1$