哪有一个字符串数组的数组店? [英] How can a string array store arrays?

查看:101
本文介绍了哪有一个字符串数组的数组店?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道下面的数组声明是正确的:

I know that the array declaration below is correct:

String[][] arrayNew={{"teresa","human","jennifer"},{"18","20"},{"nothing"}};

据我所知,字符串阵列在java.So两个不同的对象类型是怎么来的字符串数组arrayNew 成功存储在其中三个不同的阵列。
一个 INT 阵列不能存储双打,但怎么来的一个字符串数组能够存储阵列

I understand that String and array are two different object types in java.So how come the string array arrayNew is successfully storing three different arrays in it. An int array can not store doublesbut how come a string array is able to store arrays?

推荐答案

您刚刚创建的二维数组(String数组的数组)。

You are just creating a 2D array (An array of String array).

在这种特殊情况下,您创建了一个锯齿形数组。

On this particular case, you created a jagged array.

您可以为int数组做同样的还有:

You could do the same for int array as well:

int[][] array = {{1,2,3}, {4,5}, {6}};

多维数组数组的数组:

String[] arrayA;       //Array of Strings
String[][] arrayB;     //Array of (Array of Strings)
String[][][] arrayC;   //Array of (Array of (Array of Strings))
String[][][][] arrayD; //Array of (Array of (Array of (Array of Strings)))

这篇关于哪有一个字符串数组的数组店?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆