title: When to use post increment and pre increment in Java
body: <p>I understand that there are a number of questions on this topic on StackOverflow. But I am still slightly confused and unsure of when to use the operations. I am going through old tests in studying for my exam. One of the methods returns the number of classrooms that are handicapped accessible and are available. I wrote the counter method but am not sure if I am supposed to pre-increment or post increment the counter. I am confused as to how it works with return statement in methods. I still do not get what value the method will return below. The other questions do not show return values in methods and thus I am confused as to practically how it works. Here is the code:</p>
  
  <pre><code>  public int howManyHandi()
  {
      int counter= 0;
      for (int i = 0; i &lt; _clsrms.length; i++){
          if (_clsrms[i].handicappedSuitable() &amp;&amp; _clsrms[i].isAvailable()){
              ++counter;
          }
      }
      return counter;
  }  
  </code></pre>