CSC300: Common mistakes: Does this work? [28/37] Previous pageContentsNext page

01
02
03
04
05
06
07
  public static int numFives (double[] a) {
    int result = 0;
    for (int i=0; i<a.length; i++)
      if (i == 5.0)
        result++;   
    return result;
  }

Previous pageContentsNext page