No, this does not happen. Primitive elements of an array are initialized by default for a primitive value ( 0 for int ). Elements of an array of objects are initialized to null .
You can use java.util.Arrays.fill(array, defaultElementValue) to populate the array after creating it.
To quote JLS
An array is created by an array creation expression (Β§15.10) or an array initializer (Β§10.6).
If you use an initializer, then values ββare assigned. int[] ar = new int[] {1,2,3}
If you use an array creation expression (as in your example), then ( JLS ):
Each class variable, instance variable, or array component is initialized with a default value when it is created.
Bozho source share