title: Unable to understand why count is not getting incremented
body: <p>As a part of exercise, i am writing a recursive code to count the number of nodes in a queue. The code part which I have added/modified (in NodeQueue.java) is here:</p>
  
  <pre><code>public class NodeQueue implements Queue
  {
      static protected int count;                 //for RecNodeCount method only
      protected Node beingCountedNode = head;     //for RecNodeCount method only
  
  // other methods..
  
  public int RecNodeCount()
      {
          if(beingCountedNode == null)
              return count;
          else
          {
              count++;
              beingCountedNode = beingCountedNode.getNext();
              return RecNodeCount();
          }
      }
  </code></pre>
  
  <p>The entire code is as here:</p>
  
  <p>Queue.java: <a href="http://pastebin.com/raw.php?i=Dpkd8ynk" rel="nofollow">http://pastebin.com/raw.php?i=Dpkd8ynk</a></p>
  
  <p>Node.java: <a href="http://pastebin.com/raw.php?i=Zy0KbrtJ" rel="nofollow">http://pastebin.com/raw.php?i=Zy0KbrtJ</a></p>
  
  <p>NodeQueue.java: <a href="http://pastebin.com/raw.php?i=j6hieiLG" rel="nofollow">http://pastebin.com/raw.php?i=j6hieiLG</a></p>
  
  <p>SimpleQueue.java: <a href="http://pastebin.com/raw.php?i=vaTy41z4" rel="nofollow">http://pastebin.com/raw.php?i=vaTy41z4</a></p>
  
  <p>I am unable to understand why I am getting zero even after enqueueing few nodes in the queue. The <code>size</code> variable returns the correct number. I am doing more or less the same with the <code>count</code> variable (I think!) i.e. incrementing the required variable. </p>