Source Code:
public class EqualMatrix {
public static void main(String[] args) {
int[][] a = {{1, 2}, {3, 4}};
int[][] b = {{1, 2}, {3, 4}};
boolean flag = true;
for(int i=0; i<2; i++) {
for(int j=0; j<2; j++) {
if(a[i][j] != b[i][j]) {
flag = false;
}
}
}
System.out.println(flag);
}
}
Output:
