At first, an array is an object in Java. A variable name is a reference to array and you can get the elements of array using the indexes.
Multidimensional array is an array of arrays. See more.
In multidimensional array, you can declare array of arrays. In your example, it has been created int multidimensional array: int xyz[][] = new int[2][3]; 2-by-3 means you have 2 arrays and both arrays can keep 3 int numbers.
When we initialize the array, Java provides us with the default value(s) inside the array. These default values depend on the type of array. In your example, when you access the element, for example, xyz[1][1] or whatever element you want in the scope of the length of the array, you will get 0 because the type of array is int and the default value of int is zero. So, you have 2 arrays which are situated in xyz and both 2 arrays have 3 zero-valued elements before assigning values by you.
When you declare and instantiate like int xyz[][] = new int[2][3]; Java will automatically initialize xyz array with the default values like following
xyz[0] = {0,0,0};
xyz[1] = {0,0,0};
Then, you defined a new single dimensional array named y;
int[] y = {18,9,10,6,12,15,3};
and after creating y you assigned it to the zero-indexed (xyz[0]) array of xyz. xyz[0]=y; // xyz[0] = {18,9,10,6,12,15,3};
this means reassigning. Because, when you created xyz array, Java automatically initializes the elements of arrays, on the other words, assigns the default values for arrays inside xyz then you reassign first array of xyz with y. This looks like reassigning of variables, you can create
int a = 10;
and then you can reassign the number to a variable a like this:
a = 45;
So array assignment is the similar. First Java assigns values, then you reassign. First Java assigns default values, 0s, then you create a single dimensional array and reassign y to xyz[0].
That’s why you are allowed to define different sizes of arrays despite of fix-sized elements.
xyz[2][3]" since this isn't valid Java syntax - you create an integer multidimensional array object bynew int[2][3]and store the resulting reference in a variable declared for holding a reference to a two-dimensional int array:int[][] xyz.