Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to combine two object arrays in Java

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
}
like image 563
Oleaha Avatar asked Jul 03 '26 03:07

Oleaha


1 Answers

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

like image 88
systemboot Avatar answered Jul 04 '26 16:07

systemboot