我無法理解這兩個奇怪的行爲爲什麼這種奇怪的行爲?
1.首先行爲
我已經聲明如下
double[][] dd =
{
new double[10],
new double[10]
};
它不給錯誤的變量。
但是,如果我不喜歡這一點,給人如果我這樣做
double[][] dd;
dd = new double[][]{
new double[10],
new double[10]
};
爲什麼錯誤
double[][] dd;
dd = { // Here it gives 2 errors says Invalid Expression { and ; expected
new double[10],
new double[10] //Here and in the above line it says only
//assignment, call, increment....can be used as a statement
};
錯誤沒有了嗎?
2.第二行爲
更多了,如果一個逗號,
是數組的最後一個元素之後放在任何
{
new double[10],
new double[10], //This comma here is not given as error. Why?
};
應該就是多餘的逗號沒有上述情況下並非如此錯誤指定應在其後添加一個實體。