本文介绍了如何在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中合并两个对象数组
发布评论