title: Java calling a subclass method
body: <p>When i try to create an instance of a class and add this to my arraylist i can't call methods defined in the child.</p>
  
  <p>How do i make this work?</p>
  
  <p><strong>List class</strong>:</p>
  
  <pre><code>import java.util.*;
  public class List {
    private ArrayList&lt;Person&gt; persons;
    public List(){
      persons = new ArrayList&lt;Person&gt;();
    }
    public void addAssistant(){
      Person person = new Assistant();
      persons.add(person);
      if(person instanceof Assistant){
        person.assist();
      }
    }
  }
  </code></pre>
  
  <p><strong>Person class</strong>:</p>
  
  <pre><code>public class Person {
    public Person(){}
  }
  </code></pre>
  
  <p><strong>Assistant class</strong>:</p>
  
  <pre><code>public class Assistant extends Person {
    public Assistant(){}
    public void assist(){
       System.out.println("I am assisting!");
    }
  }
  </code></pre>
  
  <p>Compiler:
  line: person.assist(); within the addAssistant() method in the List class.</p>
  
  <p>Compiler error:
  The compiler cannot find symbol - method assist(). </p>