Write a short code segment that declares an integer array of 10 elements. Write the statements
required to initialize the first array element to a value of 10 and each succeeding element to a
value three times the previous element value. Use a for loop to perform this action.
This is the correct code:
The only thing I don't understand is why in the for loop conditional statement it is a.length-1. Why can't it be a.length?