title: Adding subclasses into a superclass array in Java
body: <p>I want to initialize a couple of subclasses and put them all into an array of the superclass mammal. With this code I get the error: no suitable method found for add(wolf). I have no idea what I'm doing wrong, any help is appreciated.</p>
  
  <pre><code>class gameRunner{
     cow Cow = new cow();
     wolf Wolf = new wolf();
     ArrayList&lt;mammal&gt; mammalArray = new ArrayList&lt;mammal&gt;();
  
     public gameRunner(){
       mammalArray.add(Cow);
       mammalArray.add(Wolf);
     }
  }
  </code></pre>