-1
Scanner input = new Scanner(System.in);

System.out.println("Enter matrix 1: ");
for(int row=0;row<3;row++){
    for(int col=0;col<3;col++){
        a[row][col]=input.nextDouble();
    }
}

您好 - 鉴于上述将数据输入名为 2d 3*3 数组的解决方案a,我目前无法接受用户输入。intellij ide 不接受我在input.nextDouble().

我想我错过了一些明显的东西,但是什么?:)

4

2 回答 2

3

下面的代码非常适合我

double a[][]=new double[3][3];
        Scanner input = new Scanner(System.in);

        for(int row=0;row<3;row++){

            for(int col=0;col<3;col++){
                System.out.println("Enter value: ");
                a[row][col]=input.nextDouble();
            }
        }
于 2012-10-30T00:59:42.300 回答
0

这是 JUNIT4 不接受控制台输入 - 这就是为什么将焦点更改为控制台不会产生任何结果。

于 2012-10-30T12:57:43.697 回答