0

How do I create a custom method that adds an Object to a list

I want to create a method called addAnimal(Animal a) that adds an Animal object to a zoo list.

12th May 2020, 10:25 AM
Jay
2 Réponses
+ 2
Jay Make ArrayList of Animal object ArrayList<Animal> al = new ArrayList<Animal>(); Animal a1 = new Animal(); al.add(a1);
12th May 2020, 11:07 AM
A͢J
A͢J - avatar
0
In what language? And could you post the code of the class you made?
12th May 2020, 10:45 AM
Slick
Slick - avatar