数组问题
1:编写一个方法来实现数组的合并2:编写一个方法来判定参数数组是否对称 public static int[] mergeArr(int arr1[], int arr2[]){
int newArr[] = new int;
for (int i = 0; i < newArr.length; i++) {
if(i<arr1.length) {
newArr = arr1;
}else {
newArr = arr2;
}
}
return newArr;
}
public static boolean symmetricArr(int arr[]){
int len = arr.length / 2;
for (int i = 0; i < len; i++) {
if(arr!=arr) {
return false;
}
}
return true;
}
页:
[1]