title: Using recursion how can i keep the local variable updated
body: <p>Using recursion how can i keep the local variable updated till a condition is met. I have an instance below that explains why question very well. The count variable is a local variable and very time the method goes through the count is set to 0. I cannot move the count outside the method it has to be local variable not static or anything else.. The desired output should be (3  6)</p>
  
  <pre><code>public static int returnInt(int b) {
  
          int count = 0;
  
          if (b == 6) {
  
              System.out.println(count + " " + b);
          }
  
          b += 2;
          count++;
  
          return returnInt(b);
  
      }
  </code></pre>