When using an array of objects, the data returned from the function [append] must be cast to the object array’s data type.
For example: SomeClass[] items = (SomeClass[]) append(originalArray, element).
or in your case: items = (SomeClass[]) append(originalArray, element)
with (SomeClass[]) being the crucial part that tells (casts) the Object to be of kind animal[]
Remark
Instead of just “a” it might be wise to name it listOfAnimals or arrAnimals or so.