考慮以下代碼:這個Java數組爲什麼被認爲是二維的?
class arraytest {
public static void main(String args[]) {
int[] a = null , b[] = null;
b = a;
System.out.println(b);
}
}
線
b = a;
是由編譯器標記說:
Incompatible types, found int[], required int [][]
爲什麼爲B認爲二維?我實現了「快捷方式」的宣言
int[] a = null , b[] = null;
是難辭其咎的,但爲什麼它使數組二維時只有一組括號已經寫?我覺得這個語法不清楚和混淆。
1,但對於int一個[] = NULL,B [] = NULL;會編譯得很好 – akarnokd 2009-07-18 21:35:49