← Back to Question List
Java Quiz #9
Count Zeros Method
What does this method return when called with countZeros({1, 0, 2, 0, 3})?
📄 Code
1public static int countZeros(int[] arr) {2 int count = 0;3 for (int num : arr) {4 if (num == 0) {5 count++;6 }7 }8 return count;9}