Unclosed String Literal


The “unclosed string literal” error message is created when the string literal ends without quotation marks, and the message will appear on the same line as the error. (@DreamInCode) A literal is a source code of a value.
 public abstract class NFLPlayersReference {
    private static Runningback[] nflplayersreference;
    private static Quarterback[] players;
    private static WideReceiver[] nflplayers;
    public static void main(String args[]){
    Runningback r = new Runningback("Thomlinsion");
    Quarterback q = new Quarterback("Tom Brady");
    WideReceiver w = new WideReceiver("Steve Smith");
    NFLPlayersReference[] NFLPlayersReference;
        Run();// {
        NFLPlayersReference = new NFLPlayersReference [3];
        nflplayersreference[0] = r;
        players[1] = q;
        nflplayers[2] = w;
            for ( int i = 0; i < nflplayersreference.length; i++ ) {
            System.out.println("My name is " + " nflplayersreference[i].getName());
            nflplayersreference[i].run();
            nflplayersreference[i].run();
            nflplayersreference[i].run();
            System.out.println("NFL offensive threats have great running abilities!");
        }
    }
    private static void Run() {
        System.out.println("Not yet implemented");
    }     
}

Commonly, this happens when:
  • The string literal does not end with quote marks. This is easy to correct by closing the string literal with the needed quote mark.
  • The string literal extends beyond a line. Long string literals can be broken into multiple literals and concatenated with a plus sign (“+”).
  • Quote marks that are part of the string literal are not escaped with a backslash (“\”).