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

1 Expert Approved Answer
Step: 1 Unlock

The output on the console after executing the given code segment would be ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!