Assuming Sports, School, Home are classes in Java.
with Home having a method e.g.
void add(Sports t1, School t2);
Here is what i want to do:
Sports s1 = new Sports("value1");
School t2 = new School("value1");
Home h = new Home();
h.add(s1,t2);
Now the problem is, i want to repeat these steps too many times. with h remaining the same. So that h.add() is called multiple times with different objects as parameters with values coming from outside using forloop.
can someone show me how can i initialize these objects and call
the add method in e,g a for loop with different object names in
each iteration?