Consider the following method. Method allEven is intended to return true if all elements in array arr are even numbers; otherwise, it should return false. public boolean allEven (int[] arr) boolean isEven = /* expression */ ; for (int k = 0; k < arr.length; K⁺+) /* loop body */ return isEven; Which of the following replacements for /* expression */ and /* loop body */ should be used so that method allEven will work as intended?
1) false if ((arr[k] % 2) == 0); false if ((arr[k] % 2) != 0);
2) isEven = false; else isEven = true;
3) true if ((arr[k] % 2) != 0);
4) isEven = false; else



Answer :

Other Questions