且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java中将两个整数数组合并为一个数组

更新时间:2022-12-09 19:04:52

代替

int[]c = new int[a+b];

您需要调用合并方法并将结果分配给数组,例如:

You need to call your merge method and assign the result to the array like :

int[]c = merge(a,b);

你的 for 循环也应该是:

Also you for loop should be :

int[]c = merge(a,b);
for(int i=0; i<c.length; i++)
    System.out.print(c[i]+" ");