concept multidimensional array in category java

This is an excerpt from Manning's book Java SE 11 Programmer I Certification Guide.
Nested loops are often used to initialize or iterate multidimensional arrays. The following code initializes a multidimensional array using nested for loops:
Exam objectives covered in this chapter
What you need to know
[5.1] Declare, instantiate, initialize, and use a one-dimensional array.
How to declare, instantiate, and initialize one-dimensional arrays using single and multiple steps.
The do’s and don’ts of each of these steps.
[5.2] Declare, instantiate, initialize, and use a multidimensional array.
How to declare, instantiate, and initialize multidimensional arrays using single and multiple steps, with do’s and don’ts for each of these steps.
Accessing elements in asymmetric multidimensional arrays.
In Java, you can define one-dimensional and multidimensional arrays. A one-dimensional array is an object that refers to a collection of scalar values. A two-dimensional (or more) array is referred to as a multidimensional array. A two-dimensional array refers to a collection of objects in which each of the objects is a one-dimensional array. Similarly, a three-dimensional array refers to a collection of two-dimensional arrays, and so on. Figure 7.2 depicts a one-dimensional array and multidimensional arrays (two-dimensional and three-dimensional).
Figure 7.2 One-dimensional and multidimensional (two- and three-dimensional) arrays
![]()
Note that multidimensional arrays may or may not contain the same number of elements in each row or column, as shown in the two-dimensional array in figure 7.2.
Let’s allocate the multidimensional array multiArr, as follows:
int[] multiArr[]; #A multiArr = new int[2][3]; #BYou can also allocate the multidimensional array multiArr by defining size in only the first square brackets:

This is an excerpt from Manning's book OCA Java SE 8 Programmer I Certification Guide.
Purpose: Identify the difference between an array element that isn’t initialized and an array element that doesn’t exist. A pictorial representation of a multidimensional array is quick to draw, and you can easily refer to its nonexistent or null array elements. This concept is shown in figure A.3.
Figure 4.22. Square brackets can follow either the variable name or its type. In the case of multidimensional arrays, it can follow both of them.
![]()
At the beginning of this section, I mentioned that a multidimensional array can be asymmetrical. An array can define a different number of columns for each of its rows.
class Whale { public static void main(String args[]) { boolean hungry = false; while (hungry=true) { ++Fish.count; } System.out.println(Fish.count); } } class Fish { static byte count; }