-3

public void addAnimalsToZoo() {

    Animal[] zoo = new Animal[animals.length + 5];
    System.arraycopy(animals, 0, zoo, 0, animals.length);

    for (count = 0; count < zoo.length; count++)
        System.out.println("new animals with new array" + "\t" + zoo[count]);

}
JOJO
  • 25
  • 1
  • 3

1 Answers1

0

You didn't override the toString method in your Animal class.

System.out.println("new animals with new array" + "\t" + zoo[count]);

will print a concatenation of "new animals with new array", "\t" and the result of toString called on zoo[count].

If you don't override toString, the default one (from the Object class) will be used, which results in prints like: se.mebe.Zebra@4e25154f

Stultuske
  • 9,296
  • 1
  • 25
  • 37