是否可以存储字符串数组& int阵列到Java中的一系列数组?
'''
String array[] = new String[]{"ash","String","Ukara"};
int [] ar = new int[]{1,2,3,4};
Object i[][] = {array,ar};
''' 将int数组添加到数组数组中时,显示此错误为 - >类型不匹配:无法从int []转换为对象[]
'''
String array[] = new String[]{"ash","String","Ukara"};
int [] ar = new int[]{1,2,3,4};
Object i[][] = {array,ar};
'''
On adding int array to array of array showing this error as --> Type mismatch: cannot convert from int[] to Object[]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
对象[] []
使用对象[]
和integer []
如下:其他方法,例如其他方法,例如
hashmap< string,Integer>
或新类可能对您的用例更有效。您可以创建一个新类,例如以下内容:
然后创建此类型的数组:
You could create an
Object[][]
withObject[]
andInteger[]
as follows:Alternatively, other approaches such as a
HashMap<String, Integer>
or a new class might work better for your use case.You could create a new class such as the following:
Then create an array of this type: