title: Count how often static method is called in Java
body: <p>I try to count how often a static method is called and do not know how to do it, since I can not use an instance variable within the static method as far as I know. 
  I have the following class: </p>
  
  <pre><code>public class Utilities {
  
       // print how often method was called + specific Value of Object o
       public static void showObject (Object o) {
            System.out.println(counter + ": " + o.toString());
       }
  }
  </code></pre>
  
  <p>Printing the objects-values works, but how can I make the counter count? So the result for the following code should look like this:</p>
  
  <pre><code>    public static void main (String[] args){
      Object objectA = new Object ("Object A", 4);
      Object objectB = new Object ("Object B", 4);
      Object objectC = new Object ("Object C", 4);
  
      Utilities.showObject(objectB);
      Utilities.showObject(objectC);
      Utilities.showObject(objectC);
      Utilities.showObject(objectA);
  
  
  1: 3.6
  2: 8.0
  3: 8.0
  4: 9.2
  </code></pre>
  
  <p>Greetings and thanks,
  Patrick</p>