Arrays: Working with groups of objects


Download the Alice project: animals-talk.a3p

public void myFirstMethod() {
    SJointedModel[] animals = new SJointedModel[] {
        this.cow, this.pig, this.billyGoat, this.chicken
    }
    ;
    String[] sayings = new String[] {
        "moo", "oink", "maa", "cluck"
    }
    ;
    for( Integer indexA = 0; indexA<animals.length; indexA++ ) {
        SJointedModel animal = animals[i];
        animal.say( sayings[i] );
    }
} 

NEXT: Who's the tallest?