An array is created by an array creation expression or an array initializer. The former applies to array2
(although in this case, an array initializer was provided), whereas the latter applies to array1
.
For more information, see:
- JLS, §10.3 - Array Creation
- JLS, §10.6 - Array Initializers
- JLS, §15.10 - Array Creation Expressions