Combine two integer arrays into one array in java

后端 未结 12 2174
借酒劲吻你
借酒劲吻你 2020-12-21 04:03

I\'ve seen similar questions and none provide the answer that I\'m looking for, so I apologize in advance if this is considered a duplicate. I\'m trying to combine arrays {1

12条回答
  •  情话喂你
    2020-12-21 04:46

     public class MergeArrays {
        public static void main(String[]args){
             int[] a = {1, 2, 3};
             int[] b = {4, 5, 6};
             int[] c = new int[a.length+b.length];// Here length of int[] c will be 6
             int count = 0;
    
             //looping to store the value length of i
             for(int i = 0; i

提交回复
热议问题