You need to create objects, make a list and loop through. Can I do this:
MyClass obj = new MyClass(); MyClass obj2 = new MyClass(); ArrayList objList = new ArrayList(); objList.add(obj); objList.add(obj2); for (int i = 0; i < objList.size(); i++) { //Делаем работу } Or so:
ArrayList objList = new ArrayList(); objList.add(new MyClass()); objList.add(new MyClass()); for (int i = 0; i < objList.size(); i++) { //Делаем работу } Is it possible to do that? What is added to the list in the first case: new objects or a link to already created objects?