Program Perkalian Matiks 3x3 dengan menggunakan Java Netbeans
Scanner baca = new Scanner (System.in);
final int Maxarra = 3;
int arra[][] = new int[Maxarra][Maxarra];
for (int x = 0; x < Maxarra; x++) {
for (int y = 0; y < Maxarra; y++) {
System.out.print("angka ["+x+"]["+y+"] ");
arra[x][y] = baca.nextInt();
}
}
System.out.println("");
for (int x = 0; x < Maxarra; x++) {
for (int y = 0; y < Maxarra; y++) {
System.out.print(arra[x][y]+" ");
}
System.out.println("");
}
final int Maxarrb = 3;
int arrb[][] = new int[Maxarrb][Maxarrb];
for (int x = 0; x < Maxarrb; x++) {
for (int y = 0; y < Maxarrb; y++) {
System.out.print("angka ["+x+"]["+y+"] ");
arrb[x][y] = baca.nextInt();
}
}
System.out.println("");
for (int x = 0; x < Maxarrb; x++) {
for (int y = 0; y < Maxarrb; y++) {
System.out.print(arrb[x][y]+" ");
}
System.out.println("");
}
System.out.println("");
int a [] = new int[9];
int hasil1 = (arra[0][0]*arrb[0][0])+(arra[0][1]*arrb[1][0])+(arra[0][2]*arrb[2][0]);
int hasil2 = (arra[0][0]*arrb[0][1])+(arra[0][1]*arrb[1][1])+(arra[0][2]*arrb[2][1]);
int hasil3 = (arra[0][0]*arrb[0][2])+(arra[0][1]*arrb[1][2])+(arra[0][2]*arrb[2][2]);
int hasil4 = (arra[1][0]*arrb[0][0])+(arra[1][1]*arrb[1][0])+(arra[1][2]*arrb[2][0]);
int hasil5 = (arra[1][0]*arrb[0][1])+(arra[1][1]*arrb[1][1])+(arra[1][2]*arrb[2][1]);
int hasil6 = (arra[1][0]*arrb[0][2])+(arra[1][1]*arrb[1][2])+(arra[1][2]*arrb[2][2]);
int hasil7 = (arra[2][0]*arrb[0][0])+(arra[2][1]*arrb[1][0])+(arra[2][2]*arrb[2][0]);
int hasil8 = (arra[2][0]*arrb[0][1])+(arra[2][1]*arrb[1][1])+(arra[2][2]*arrb[2][1]);
int hasil9 = (arra[2][0]*arrb[0][2])+(arra[2][1]*arrb[1][2])+(arra[2][2]*arrb[2][2]);
System.out.println(hasil1+"\t"+hasil2+"\t"+hasil3);
System.out.println(hasil4+"\t"+hasil5+"\t"+hasil6);
System.out.println(hasil7+"\t"+hasil8+"\t"+hasil9);
//untuk nama scanner terrserah, bisa diganti