Problems with Arrays

I didn’t look through all of it, but there is an issue with the line above. In that line “Trees[5]” refers to one specific “Tree” object in the array, but the array does not have an object at index 5, only 0 through 4.

If you want to loop through the array and do something with each object you could do something like this:

for(Tree tree : Trees) {
  // each time through the loop the "tree" variable 
  // refers to the next Tree object in array Trees
  tree.drawTree();
}