Write the definition of a method oddsMatchEvens whose two p
Write the definition of a method , oddsMatchEvens, whose two parameters are arrays of integers of equal size. The size of each array is an even number. The method returns true if and only if the even-indexed elements of the first array equal the odd-indexed elements of the second, in sequence. That is if w is the first array and q the second array , w[0] equals q[1], and w[2] equals q[3], and so on.
java language please
Solution
OddEvenTest.java
 public class OddEvenTest {
   public static void main(String[] args) {
        System.out.println(oddsMatchEvens(new int[]{1,2,3,4,5,6,7,8},new int[]{0,1,2,3,4,5,6,7} ));
        System.out.println(oddsMatchEvens(new int[]{1,2,3,4,5,6,7,8},new int[]{0,1,2,9,4,5,6,7} ));
    }
   public static boolean oddsMatchEvens(int a[], int b[]){
            for(int i=0; i<a.length-1;i+=2){
                if(a[i] != b[i+1]){
                    return false;
                }
            }
            return true;
    }
 }
Output:
true
 false

