Answers for "How do you merge arrays"

C#
0

merging to arrays

const array1 = ["item1", "item2"];

const array2 = ["item3", "item4", "item5", "item6"];

const array3 = array1.concat(array2);
// ["item1", "item2", "item3", "item4", "item5", "item6"]
Posted by: Guest on July-01-2021
0

concat two arrays

public static void main(String[] args) {

       String[] arr3 = {"A", "B", "C","Z","N"};
       String[] arr4 = {"D", "E", "F","G","U"};
ArrayList<String> list1 = new ArrayList<>();  
//  [A, B, C, Z, N, D, E, F, G, U]

       for( String each: arr3 ){
           list1.add( each );
       }
       for(String each1 : arr4  ){
           list1.add(each1);
       }
System.out.println(list1); // [A, B, C, Z, N, D, E, F, G, U]
Posted by: Guest on June-09-2021

C# Answers by Framework

Browse Popular Code Answers by Language