1Z0-811 • Practice Test 31
Free 1Z0-811 practice test — 15 questions with explanations. Set 31. No signup required.
A developer is writing a Java method that must return the smallest even number in an int array. If no even number exists, the method must return -1. The developer writes:
public static int firstEven(int[] nums) {
for (int i = 0; i < nums.length; i++) {
if (nums[i] % 2 == 0) {
return nums[i];
}
}
return -1;
}Which statement describes the behavior of this method?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.