title: Why should the static field be accessed in a static way?
body: <pre><code>public enum MyUnits
  {
      MILLSECONDS(1, "milliseconds"), SECONDS(2, "seconds"),MINUTES(3,"minutes"), HOURS(4, "hours");
  
      private MyUnits(int quantity, String units)
      {
          this.quantity = quantity;
          this.units = units;
      }
  
      private int quantity;
      private  String units;
  
   public String toString() 
   {
      return (quantity + " " + units);
   }
  
   public static void main(String[] args) 
   {
      for (MyUnits m : MyUnits.values())
      {
          System.out.println(m.MILLSECONDS);
          System.out.println(m.SECONDS);
          System.out.println(m.MINUTES);
          System.out.println(m.HOURS);
      }
   }
  }
  </code></pre>
  
  <p>This is referring to <a href="https://stackoverflow.com/questions/4801774/ways-to-improve-foll-java-code">post</a> ..wasnt able to reply or comment to any so created a new one. Why are my </p>
  
  <pre><code>System.out.println(m.MILLSECONDS);
  </code></pre>
  
  <p>giving warnings-The static field MyUnits.MILLSECONDS should be accessed in a static way ?
  Thanks.</p>