How to print a rectangular matrix? java [duplicated]

0

Hi, I would like to know how I can print this 2x3 matrix since it always prints it 2x2

public static void main(String[] args) {

double notas[][]= new double[2][3];
int i;
int j;

    String acum="\n";
for(i=0;i<notas.length;i++)
{
    for(j=0;j<notas.length;j++)
    {
        notas[i][j]=Double.parseDouble(JOptionPane.showInputDialog("Ingrese una nota"));
         acum= acum+" "+notas[i][j];
    }
    acum+="\n";
}
JOptionPane.showMessageDialog(null,acum);

}
    
asked by Liza Urbina 29.04.2018 в 22:50
source

1 answer

0

As mentioned by Malbarez, you are missing notes [i], so you are only taking the number of rows and not the columns.

        for (i = 0; i < notas.length; i++) {
        for (j = 0; j < notas[i].length; j++) {
    
answered by 29.04.2018 / 23:10
source