Explain your own example programming application in which you can effectively use a multidimensional array (or sequence type) to organize the data.
Multidimensional array can be used in adding two matrices.
Example
public class Main
{
public static void main(String[] args)
{
int[][] array1 = { { 1, 2 }, { 3, 4 } };
int[][] array2 = { { 5, 6 }, { 7, 8 } };
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
int n=array1[i][j]+array2[i][j];
System.out.print(n + "\t");
}
System.out.println();
}
}
}
Comments