Java examples for Collection Framework:Array Element
connect Object Arrays
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { Object[] a1 = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; Object[] a2 = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; System.out//from w w w . jav a 2s . co m .println(java.util.Arrays.toString(connectArrays(a1, a2))); } public static Object[] connectArrays(Object[] a1, Object[] a2) { Object[] ret = new Object[a1.length + a2.length]; for (int i = 0; i < a1.length; i++) { ret[i] = a1[i]; } for (int i = 0; i < a2.length; i++) { ret[a1.length + i] = a2[i]; } return ret; } }