Strange behavior storing objects on an array

The problem is that it isn't working that way.