plasticfood 0 Junior Poster in Training

this is a linked list based queue

private class Node
    {
        String value;
        Node next;
        Node(String val, Node n)
        {
            value = val; 
            next = n;
        }       
    }


  public String dequeue()
    {
       if (empty()) 
           throw new EmptyQueueException();
       else
       {
           String value = front.value;
           front = front.next;
           if (front == null) rear = null;    
           return value;
       }
    }

--------
i get the enqueue part where you add an item, but the the dequeue part is confusing me.

wouldn't front = front.next be equal to null? and if so, when calling the dequeue() again, how does that remove anything?

so if i had 3 objects, front is pointing to the first obj, and rear is pointing to the last obj, how would front know to point at the next obj after removing the first one?