Your have to add matrices. This does not work, and I'm not sure how to fix it! The two matrices I have inputed are shown below.
When I output the code, I get the location in the RAM instead of the added matrices.
I'm not sure where it went wrong! I would appreciate HELP! Thank you! :D
public static double[][] add(double[][] a1, double [][] a2)
{
for (int r = 0; r<a1.length; r++)
{
for (int c = 0; c<a1[r].length; c++)
{
a1[r][c] = a1[r][c] + a2[r][c];
}
}
return a1;
}
public static void main(String[] args)
{
double [][] arr = {{1,3,4},
{2,0,1}};
double [][] arr1 = {{0,0,2},
{5,6,7}};
System.out.println(Matrix.add(arr, arr1));
}