Java: create objects and call their methods in loops

I don’t quite understand why we have to put the for loop in the setup function, can you help me with that? Anyway, thanks alot.