I am trying to multiply matrices in the following way, without success.
package multiplicacionaleatoria;
import javax.swing.JOptionPane;
public class MultiplicacionAleatoria {
public static void main(String args[]) {
int n = Integer.parseInt(JOptionPane.showInputDialog("ingrese numero de filas de la primera matriz")); // x1
int m = Integer.parseInt(JOptionPane.showInputDialog("ingrese numero de columnas de la primera matriz")); //x2
int o = Integer.parseInt(JOptionPane.showInputDialog("ingrese numero de filas de la segunda matriz")); //y1
int p = Integer.parseInt(JOptionPane.showInputDialog("ingrese numero de columnas de la primera matriz"));//y2
int[][] m1 = new int[n][o];
int[][] m2 = new int[m][p];
int[][] mR = new int[n][p];
for (int i = 0; i < n; i++) {
for (int j = 0; j < o; j++) {
m1[i][j] = Integer.parseInt(JOptionPane.showInputDialog("numeros de la matriz 1 "));
Integer.parseInt(JOptionPane.showInputDialog(m1[i][j] + " "));
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < p; j++) {
m2[i][j] = Integer.parseInt(JOptionPane.showInputDialog("numeros de la matriz 2 "));
Integer.parseInt(JOptionPane.showInputDialog(m2[i][j] + " "));
}
}
if (p == m) {
JOptionPane.showMessageDialog (null,( "La matriz resultante es: "));
for (int i = 0; i < n; i++) {
for (int j = 0; j < p; j++) {
for (int h = 0; h < n; h++) {
mR[i][j] += m1[i][h] * m2[h][j];
}
Integer.parseInt(JOptionPane.showInputDialog(mR[i][j] + " "));
}
}
} else {
JOptionPane.showMessageDialog(null,("Los rangos de las matrices son incorrectos"));
}
}
}