Based on this question Increment variable names?
I have an arraylist 'peopleHolder' which holds various 'person' objects. I would like to automatically create 'person' objects based on a for loop. I did the following
peopleHolder.add(new person());
I would like to call methods from the person class. for example person.setAge;
How can I call such methods through an arraylist?
I would like the method to set values for each object.
I have looked at this answer: Java - calling methods of an object that is in ArrayList
But I think the solution depends on calling static method and I would like to have the method specific to the object as they store the objects value.