Arrays: Working with groups of objects


Download the Alice project: array-objects.a3p

public void myFirstMethod() {
    SJointedModel[] animals = new SJointedModel[] {
        this.yeti, this.tortoise, this.stuffedTiger
    }
    ;
    Integer counter = 0;
    while ( true ) {
        counter = counter+1;
        animals[counter%3].say( ""+counter );
    }
}  

NEXT: Segments of an elephant's trunk as an array