使用双下标访问二维数组中的元素:
第一个下标代表:行号(高维下标)。
第二个下标代表:列号(低维下标)。
2.赋值实例
(1)赋值:从最高维开始,分别为每一维分配空间,例如:
string s[][] = new string[2][];s[0] = new string[2];s[1] = new string[3];s[0][0] = new string(good);s[0][1] = new string(luck);s[1][0] = new string(to);s[1][1] = new string(you);s[1][2] = new string(!);
(2)输出
for (int i=0; i
good luck to you !
以上就是java二维数组如何赋值的详细内容。