My code is this one:
Scanner teclado = new Scanner(System.in);
System.out.println("Rellena con un caracter cada elemento de la primera matriz m1(" + filas1 + "," + cols1 + "), escribe sólo la letra.");
for (int fila = 0; fila < m1.length; fila++) {
for (int col = 0; col < m1[fila].length; col++) {
caracter = teclado.nextLine();
m1[fila][col] = caracter.charAt(0);
}
}
It gives an exception here m1[fila][col] = caracter.charAt(0);
Java.StringIndexOutOfBoundsException
It is curious because the line before that, it doesn't prompt the Scanner asking for a String, just throw the exception, so I commented the line that gives the exception and yes, it prompts the Scanner asking for the String.
I am a bit confused why it is happening.