title: .add() method not working for ArrayList
body: <p>I'm learning Java and I'm stuck with a little problem.
  The method .add() applied to my ArrayList object doesn't want to compile.
  I tried the same thing (with different parameters) on another program and it is working fine, so there's clearly something I've done wrong this time, but I can't figure out what. Any help would be appreciated.</p>
  
  <pre><code>import java.util.List;
  import java.util.ArrayList;
  private List&lt;String&gt; science = new ArrayList&lt;String&gt;();
  science.add("geography");
  </code></pre>
  
  <p>This bit of code gives me the following error:</p>
  
  <ul>
  <li>Syntax error, insert ")" to complete MethodDeclaration   </li>
  <li>Syntax error, insert "SimpleName" to complete 
   QualifiedName  </li>
  <li>Syntax error on token ".", @ expected after this token</li>
  <li>Syntax error, insert "Identifier (" to complete 
   MethodHeaderName</li>
  </ul>
  
  <p>This is the entire code of the program:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  public class Facolta {
  
          private String nome;
          private int facilities, tipo;
          private List&lt;String&gt; science = new ArrayList&lt;String&gt;();
          private List&lt;String&gt; other = new ArrayList&lt;String&gt;();
  
          science.add("geography");
  
  
          public Facolta(String nome, int facilities, int tipo) {
              this.nome = nome;
              if (science.toString().contains(nome)) {
                  this.tipo = 2;
              }
              else if (other.toString().contains(nome)) {
                  this.tipo = 1;
              }
              this.facilities = facilities;
          }
  
          public String getNome() {
              return nome;
          }
  
          public void setNome(String nome) {
              this.nome = nome;
          }
  
          public void getFacilities() {
              if (tipo == 1)
                  System.out.println("Lab number: " + facilities);
              else if (tipo == 2)
                  System.out.println("Library number: " + facilities);
              else
                  System.err.println("Facility not available.");
  
          }
  
          public void setFacilities(int facilities) {
              if (facilities &lt; 3) this.facilities = facilities;
              else System.err.println("Facility not specified.");
          }
  
  }
  </code></pre>