String[][] test = {{"1","abc"},{"2","edf"}};
String[][] test = null;
----------------------------------------------------------------------------
test = {{"1","abc"},{"2","edf"}};
改成
test = new String[] {{"1","abc"},{"2","edf"}};
就可以啦
String[][] test = null;
----------------------------------------------------------------------------
test = {{"1","abc"},{"2","edf"}};
改成
test = new String[] {{"1","abc"},{"2","edf"}};
就可以啦
1、String[][] test = {{"1","abc"},{"2","edf"}};
这种方法可以不直接数组大小,但是系统根据后面的值确定。2、String[5][7] test;
for (int i=0;i<5;i++){
for (int j=0;j<7;j++) {
String[i][j]= "";
.....
}
}
这个方法必须预先指定数组的大小,这个编译器的要求。3、如果想使用不预先指定大小(动态增加)的数组结构,可以使用向量(vector)或者哈希表。