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.
class gameRunner{
cow Cow = new cow();
wolf Wolf = new wolf();
ArrayList<mammal> mammalArray = new ArrayList<mammal>();
public gameRunner(){
mammalArray.add(Cow);
mammalArray.add(Wolf);
}
}
cow,wolfandmammal. Also, note that by convention Java class names start with a capital letter.