When you type x = 0 that is creating a new int variable (name) and assigning a zero to it.
When you type x[age1] that is trying to access the age1‘th entry, as if x were an array.
When you type x = 0 that is creating a new int variable (name) and assigning a zero to it.
When you type x[age1] that is trying to access the age1‘th entry, as if x were an array.