title: why Java recursion code doesnt work properly? returns false output
body: <p>Why does the recursion fail counting all possibilities but counts just one?</p>
  <p>my code originally has meant to check the number of ways the numbers: 1,2,3,4 can be added in order to give a 10.
  though it returns 1 every time...</p>
  <p>I have been looking for an answer a lot online but got no good result, does someone know how to fix it?</p>
  <p>the code:</p>
  <pre><code>public class main {
      static int count = 0;
      public static boolean work(int i){
          if (i == 10){
              count +=1;
              return true;
          }else if(i&gt;10){
              return false;
          }
          return work(i+4)||work(i+3)||work(i+2)||work(i+1);
      }
  
      public static void main(String[] args) {
  
          work(0);
          System.out.println(count);
          
      }
  
  }
  </code></pre>