一个奇怪的令人沮丧的Java语法错误

时间:2018-05-05 17:06:05

标签: java eclipse syntax-error

我无法弄清楚这里出了什么问题,我总是得到错误 "令牌上的语法错误" =",此符号后面的表达式",  但我无法弄清楚这意味着什么。

 import java.util.Arrays;

 public class Zeitmessen {

public static void main(String[] args) {

    int zahl = 1;
    while (zahl <= 8) {

        long zeit = System.currentTimeMillis();
        double[][] quicktipp = new double[zahl][6];
        for (int i = 0; i < quicktipp[0].length; i++) {
            double random = (int) (Math.random() * 45);
            zahl++;
            quicktipp = [zahl][6];
            quicktipp[0][i] = random;
            zahl++;
            quicktipp[1][i] = random;
            zahl++;
            quicktipp[2][i] = random;
            zahl++;
            quicktipp[3][i] = random;
            zahl++;
            quicktipp[4][i] = random;
            zahl++;
            quicktipp[5][i] = random;
            zahl++;
            quicktipp[6][i] = random;
            zahl++;
            quicktipp[7][i] = random;






        }

        for (int x = 0; x < quicktipp.length; x++) {
            System.out.println(Arrays.toString(quicktipp[x]));

        }
        zeit = System.currentTimeMillis() - zeit;
        System.out.println(zeit);
        System.out.println("");

        }

}

}

     quicktipp = [zahl][6];

这里我收到了错误

有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:1)

quicktipp = [zahl][6];没有任何意义。我怀疑你认为你需要在那时或某些时候初始化数组,但是你还没有,你已经用double[][] quicktipp = new double[zahl][6];完成了这个。因此,您只需删除该行,然后直接转到quicktipp[0][i] = random;代码即可。