Zebra0.com

alice arraysArrays: Working with lists of objects

Arrays: Working with lists 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: Birds spread wings and say something