CSC300: Common mistakes: Does this work? [11/17] Previous pageContentsNext page

11
12
13
14
15
16
17
18
19
20
  public int numFives () {
    Node x = first;
    int result = 0;
    while (x != null) {
      if (x.item == 5.0)
        result = result + 1;
      x = x.next.next; 
    }
    return result;
  }

Previous pageContentsNext page