I would like too add two 2D arrays using a recursive method with this code:
public static int[][] x(int one[][],int two[][],int i,int j,int sum[][]){
if(i==one.length-1 && j==(one[0].length-1)){
return sum;
}
else if(j>one[0].length){
j=0;i++;
return x(one,two,i,j,sum);
}
else {
j++;
sum[i][j]=one[i][j]+two[i][j];
return x(one,two,i,j,sum);
}
}
but, this code doesn't work correctly. I did not understand.
Thanks!