describe even higer dimensions in javayou dont


Describe even higer dimensions in java?

You don't have to stop along with two dimensional arrays. Java allows arrays of three, four or more dimensions. Therefore chances are pretty good in which if you required more than three dimensions in an array, you're probably by using the wrong data structure. Still three dimensional arrays are exceptionally rare outside of scientific and engineering applications.

The syntax for three dimensional arrays is a direct extension of that for two-dimensional arrays. The program below declares, allocates and initializes a three-dimensional array. The array is filled along with the sum of its indexes.

class Fill3DArray {
   public static void main (String args[]) {
      int[][][] M;
    M = new int[4][5][3];
      for (int row=0; row < 4; row++) {
      for (int col=0; col < 5; col++) {
        for (int ver=0; ver < 3; ver++) {
          M[row][col][ver] = row+col+ver;
        }
      }
    }
      }
  }

You required the additional nested for loop to handle the extra dimension. The syntax for still higher dimensions is same. Just add another pair of brackets and another dimension.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: describe even higer dimensions in javayou dont
Reference No:- TGS0284451

Expected delivery within 24 Hours