Question: Given the q2() method below: public static int q2(int[] array) { int index = 0; for (int i = 0; i < array.length; i++) {
Given the q2() method below:
public static int q2(int[] array) {
int index = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] < array[index]) index = i;
}
return index;
}
What would be the output on the console after executing the following code segment?
int[] array = {22, 99, 11, 99, 33};
System.out.println(q2(array));
Step by Step Solution
There are 3 Steps involved in it
The output on the console after executing the given code segment would be ... View full answer
Get step-by-step solutions from verified subject matter experts
