title: Java NullPointerException when extending parent class
body: <p>I'm getting <code>NullPointerException</code> whith below code.</p>
  
  <p>Parent.java</p>
  
  <pre><code>public abstract class Parent {
  
      public Parent(){
          parentFunc();
      }
  
      public abstract void parentFunc();
  }
  </code></pre>
  
  <p>Child.java</p>
  
  <pre><code>public class Child extends Parent {
      ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
  
      @Override
      public void parentFunc() {
          list.add("First Item");
      }
  }
  </code></pre>
  
  <p>when I create and instance of <code>Child</code> like <code>new Child()</code> I'm getting <code>NullPointerException</code>
  Here is my console output</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at Child.parentFunc(Child.java:8)
      at Parent.&lt;init&gt;(Parent.java:5)
      at Child.&lt;init&gt;(Child.java:3)
      at Main.main(Main.java:8)
  </code></pre>
  
  <p>I know that exception occurs because of Child.parentFunc() which called in parent constructor, but I really got confused. So I wonder what is going on</p>
  
  <p><strong>What is the order of creation;</strong></p>
  
  <ol>
  <li>When list variable is created</li>
  <li>When constructors are called</li>
  <li>When functions are created and called which called in constructors</li>
  </ol>