我正在编写一个程序来合并两个排序的数组,并且出现了此问题。 编译器生成的错误说:
"Compilation Failed
./Solution.java:16: error: cannot find symbol
while(i"
请帮助。
public static int[] merge(int arr1[], int arr2[]){
int i=0;
int j=0;
int k=0;
int merge[]=new int [arr1.length+arr2.length];
while(i<arr1.length && j<arr2.length){
if(arr1[i]<=arr2[j]){
merge[k]=arr1[i];
i++;
k++;
}else{
merge[k]=arr2[j];
j++;
k++;
}
}
while(i<arr.length){
merge[k]=arr1[i];
i++;
k++;
}
while(j<arr2.length){
merge[k]=arr2[j];
j++;
k++;
}
return merge;
}