title: Unable to add a String to an ArrayList: "misplaced construct(s)"
body: <p>I am trying to add a string to an ArrayList in Java, but I can't seem to get it to work.</p>
  
  <p>Currently, I have the following code:</p>
  
  <pre><code>List food_names = new ArrayList();
  
  food_names.add("pizza");
  </code></pre>
  
  <p>Why do I get these errors:</p>
  
  <blockquote>
    <ul>
    <li>Syntax error on token ""pizza"", delete      this token</li>
    <li>Syntax error on token(s), misplaced      construct(s)</li>
    </ul>
  </blockquote>