Which boolean expression indicates whether the values for the nodes pointed to by p and q are the same? Assume that neither p nor q is null.

p.element() == q.element()
  • p.element == q.element
  • p.e == q.e
  • p == q
  • p.next == q.next
  • None of these

It does us no good to compare pointers.

We have to compare the field in each node that contains the value.

But remember that we get to a field of a node by calling a method to return that field's value