title: Adding "this" reference to Array fails in Java Constructor
body: <p>I am absolute clueless why the following code keeps throwing NullpointerExceptions. I was not able to understand or debug this (its stripped down code from a larger class)...</p>
  
  <p>The code is based on the "Enum Pattern" and I want to keep a List/Map of all "Constants" that are contained in the class (I might be using Reflection for this but using a List/Map is much easier...)</p>
  
  <pre><code>   public class Country {
  
          public static final Country SWITZERLAND = new Country("SWITZERLAND");
  
          private static ArrayList&lt;Country&gt; countries = new ArrayList&lt;Country&gt;();
  
          private  Country(String constname) {     
               //constname is currently not used (I will use it for a Key in a Map)
              System.out.println(constname);
              System.out.println("Ref debug:"+this);
  
              //Ad this to the Countries
              Country.countries.add(this);
          }
      }
  </code></pre>
  
  <p>Help would be very much appreciated. What am I missing here?</p>