CSC300: Common mistakes: Does this work? [3/10] Previous pageContentsNext page

01
02
03
04
05
06
07
  public int numFives () {
    int result = 0;
    for (Node x = first; x != null; x = x.next) 
      if (x.item == 5.0)
        result = result + 1;
    return result;
  }

Previous pageContentsNext page