All pastes #396124 Raw Edit

here you go damian

public text v1 · immutable
·published 2007-03-15 14:57 UTC
rendered paste body
 private Animal[] myFarm = new Animal[4];
    
    public Farm(){
        myFarm[0] = new Cow();
        myFarm[1] = new Chick();
        myFarm[2] = new Pig();
        myFarm[3] = new NamedCow("Elsie");

    }
    
    public void animalSounds(){
        Animal temp;
        for (int i = 0; i < myFarm.length; i++){
            temp = myFarm[i];
            System.out.println(temp.getType() + " goes " + temp.getSound());
        }