help me plz
The program does not sum the elements of the 2 matrix
this my code
package javaapplication143;
import java.util.*;
public class JavaApplication143 {
public static void ReadMatrix(int [][]a1 ){
int val=0;
Scanner input=new Scanner(System.in);
System.out.println("Enter 3 rows and 3 Columns for matrix 1 ");
for(int i=0 ; i <3 ; i++){
for(int j=0 ; j <3 ; j++){
val=input.nextInt();
}
}
}
public static void ReadMatrix2( int [][]b1 ){
int val2=0;
Scanner input=new Scanner(System.in);
System.out.println("Enter 3 rows and 3 Columns for matrix 2 ");
for(int i=0 ; i <3 ; i++){
for(int j=0 ; j <3 ; j++){
val2=input.nextInt();
}
}
}
public static void sumMatrix(int [][]a , int [][]b , int[][] sum ){
System.out.println("Sum of entered matrices:-");
for ( int i = 0 ; i < 3 ; i++ ){
{
for ( int j = 0 ;j < 3 ; j++ ){
sum[i][j]=a[i][j]+ b[i][j];
System.out.print(sum[i][j]+"\t");
}
}
System.out.println();
}
}
public static void main(String[] args) {
int [][]a=new int[3][3];
int [][]b=new int[3][3];
int [][]sum=new int[3][3];
ReadMatrix(a) ;
ReadMatrix2(b) ;
sumMatrix(a,b,sum);
}
}
and this the answer
Enter 3 rows and 3 Columns for matrix 1
1
2
3
4
5
6
7
8
9
Enter 3 rows and 3 Columns for matrix 2
1
2
3
4
5
6
7
8
9
Sum of entered matrices:-
0 0 0
0 0 0
0 0 0