fork download
  1. public class MatrixMultiplicationExample{
  2. public static void main(String args[]){
  3. System.out.println(" MUSAKALIM KHAN");
  4. int a[][]={{1,1,1},{2,2,2},{3,3,3}};
  5. int b[][]={{1,1,1},{2,2,2},{3,3,3}};
  6.  
  7. //creating another matrix to store the multiplication of two matrices
  8. int c[][]=new int[3][3];
  9.  
  10.  
  11. for(int i=0;i<3;i++){
  12. for(int j=0;j<3;j++){
  13. c[i][j]=0;
  14. for(int k=0;k<3;k++)
  15. {
  16. c[i][j]+=a[i][k]*b[k][j];
  17. }
  18. System.out.print(c[i][j]+" ");
  19. }
  20. System.out.println();
  21. }
  22. }
  23.  
  24. }
Compilation error #stdin compilation error #stdout 0.13s 48192KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class MatrixMultiplicationExample is public, should be declared in a file named MatrixMultiplicationExample.java
public class MatrixMultiplicationExample{
       ^
1 error
stdout
Standard output is empty