1import java.util.Arrays;
2
3public class Concat {
4
5 public static void main(String[] args) {
6 int[] array1 = {1, 2, 3};
7 int[] array2 = {4, 5, 6};
8
9 int aLen = array1.length;
10 int bLen = array2.length;
11 int[] result = new int[aLen + bLen];
12
13 System.arraycopy(array1, 0, result, 0, aLen);
14 System.arraycopy(array2, 0, result, aLen, bLen);
15
16 System.out.println(Arrays.toString(result));
17 }
18}
1public static void main(String[] args) {
2
3// for each ile cozumu
4 String[] arr3 = {"A", "B", "C","Z","N"};
5 String[] arr4 = {"D", "E", "F","G","U"};
6
7ArrayList<String> list1 = new ArrayList<>(); //[A, B, C, Z, N, D, E, F, G, U]
8
9 for( String each: arr3 ){
10 list1.add( each );
11 }
12 for(String each1 : arr4 ){
13 list1.add(each1);
14 }
15 System.out.println(list1); // [A, B, C, Z, N, D, E, F, G, U]
16 }
17