有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么给定数组不返回false

int[] array2 = new int[]{1,2,6,6,3,1,};
//method checks if the given array contents remain the same when array is reversed
public static boolean verify(int[] array, int index) {//method takes array and an index number

    if ((array[index] == array[array.length - index-1]) && (index < array.length/2)) {
        System.out.print("true/");
        verify(array, ++index);// increase index number to check the next values in the th array
        return true;
    } else
        System.out.println("..false..");
        return false;
    }

共 (0) 个答案