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.
2 odpowiedzi
+ 2
Jay Make ArrayList of Animal object
ArrayList<Animal> al = new ArrayList<Animal>();
Animal a1 = new Animal();
al.add(a1);
0
In what language? And could you post the code of the class you made?