While thats mostly correct, when you declare the array you put the length in the brackets, a 12 item array(indices 0-11) would be declared
int[] myArray = new int[12];
To explain why it didn't compile, since you declared the array inside of the loop it had loop local scope, meaning each time through the loop it destroyed and created a new array, after finishing the loop it again destroyed the array. From there on if you try to reference it you will be given a compile time error since the array no longer exists.