X604: Debug Code Q2

What type of error found on line 3?

public static int minVal(int[] y, int first, int last) {
  int bestSoFar = y[first];          // line 1
  for (int i=first+1; i<=last; i++)
  {
    if ( y[i] < y[bestSoFar] )       // line 2
       bestSoFar = i;               // line 3
  } // for
  return bestSoFar;                  // line 4
} // method minVal

Your Answer:

Select one answer:


Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.