Write a method called matrixAdd that accepts a pair of two-dimensional arrays of integers as parameters, treats the arrays as two-dimensional matrixes, and returns their sum. The sum of two matrixes A and B is a matrix C , where for every row i and column j, . You may assume that the arrays passed as parameters have the same dimensions.
public static int[][] matrixAdd(int[][] A, int[][] B)
{
int[][] C = new int[A.length][A[0].length];
for(int i = 0; i < A.length; i++)
{
for(int j = 0; j < A[i].length; j++)
{
C[i][j] = A[i][j] + B[i][j];
}
}
return C;
}