title: Accessing Static variables
body: <pre><code>public class Bicycle {
  
      private int cadence;
      private int gear;
      private int speed;
      private int id;
      private static int numberOfBicycles = 0;
  
      public Bicycle(int startCadence, int startSpeed, int startGear){
          gear = startGear;
          cadence = startCadence;
          speed = startSpeed;
  
          id = ++numberOfBicycles;
      }
         // ...
  }
  </code></pre>
  
  <p>I learned in my class that <code>Static variables should be accessed by calling with class name</code>. i.e. <code>ClassName.VariableName</code>  </p>
  
  <p>But in the code above, how is this statement <code>id = ++numberOfBicycles;</code> compiled without errors, even though the variable <code>numberOfBicycles</code> is <code>static</code>   </p>