Check out example codes for "java loop object". It will help you in understanding the concepts better.

Code Example 1

MyObject objects[] = new MyObject[6];
for (MyObject o: objects) {

    o = new MyObject();
}

MyObject objects[] = new MyObject[6];
for(int i = 0; i < objects.length; i++) {

    objects[i] = new MyObject();
}

Learn ReactJs, React Native from akashmittal.com