I added a comment into each example to clarify what's going on.
First example:
MyObject objects[] = new MyObject[6];
for(MyObject o: objects) {
// Construct a new object of type MyObject and assign a reference to it into
// the iteration variable o. This has no lasting effect, because the foreach
// loop will automatically assign the next value into the iteration variable
// in the the next iteration.
o = new MyObject();
}
Second example:
MyObject objects[] = new MyObject[6];
for(int i = 0; i < objects.length; i++) {
// Construct a new object of type MyObject and store a reference to it into the
// i-th slot in array objects[]:
objects[i] = new MyObject();
}