如何在Java中合并两个对象数组

编程入门 行业动态 更新时间:2024-10-27 12:26:55
本文介绍了如何在Java中合并两个对象数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有这个小脚本,可以从excel文件中获取信息.收集完所需的信息后,我想将这两个数组合并为一个.有可能吗?

I have this little script that gets information from an excel file. After I've collected the information that i need i want to combine these two arrays into one. Is that possible?

public Object[][] createData1() throws Exception { Object[][] retObjArr1 = data.getTableArray("C:\\Users\\OAH\\Workspaces\\Chrome2\\Testdata2.xls", "Sheet1", "normalCustomer"); Object[][] retObjArr2 = data.getTableArray("C:\\Users\\OAH\\Workspaces\\Chrome2\\Testdata2.xls", "Sheet2", "langLogin"); return(retObjArrCombined); //I want to return one array with both arrays }

推荐答案

您可以使用 System.arraycopy 方法(是,全部为小写). Javadoc .您可以使用 java.util.Arrays 类对数组做更多的事情.

You can use the System.arraycopy method (yes, all lowercase). Javadoc. You can do more stuff with arrays using the java.util.Arrays class.

更多推荐

如何在Java中合并两个对象数组

本文发布于:2023-10-24 23:54:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1525356.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   对象   两个   如何在   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!