1) To teach you how to declare and index 2-dimensional arrays 2) To show you how to iterate over two dimensional arrays with nested loops 3) To demonstrate higher dimensional arrays Motivation Arrays are a powerful data structure, but sometimes we want to store a table of data, not just a linear list. That is where 2 dimensional arrays come in. In Java, to make a 2 dimensional array, we make an array of arrays. This is easy because an array is just a special kind of object in Java. Common uses of 2D arrays include digital images (2D arrays of color values), grades for students in different assignments, and stock quotes for multiple stocks over time. Declaring 2D arrays In Java, to make a 2D array, we simply declare an array where the type is an array. To see how this works, first look at how we create an int array with 10 celements. One might type int) arrD new int [10]; What the above code actually does is create a new object of type "int Array" that reserves enough space to store 10 integers. Since an int array (written int) is just a type of object, we can make an array of them, by appending another set of square brackets: inti) arr2D-new inti31 [71 This declares a two dimensional array of ints with 3 rows and 7 columns. By convention, we think of the array as being indexed in "Row Major Order", which means that the row (y value) comes before the column (x value). Thus, visually, the array looks like this: The top left element is at position [0][0), and the bottom right element is at position [2][6]. The aray elements are initialized just as in the ID case (numerics are set to 0, and object types are set to null). Write the answers to the numbered questions in a file called lab8answers.txt. Write your name at the top of this filc. Q1) What code would you use to create a 2D array of double with 4 rows and 9 columns? s one of the elements of a 2D array, we use double bracket notation again, so we can write arr2D[011 arr2D [234