CSC300: Common mistakes: Does this work? [37/37] Previous pageContents

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

Previous pageContents