Example

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$
}

Solution
Declare constant
  1. Declare constant with a meaningful name to represent the string literal.
  2. Replace all occurences of the string literal with references to declared constant.

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$