title: Why does the field declaration of a list in a child class make it null?
body: <p>I currently have 2 classes with the following structure (simplified here):</p>
  
  <pre><code>class A
  {
    private List&lt;String&gt; myList = new ArrayList&lt;&gt;();
  
    public A()
    {
      init();
    }
  
    public void init()
    {
      myList.add("apple");
    }
  }
  
  
  class B extends A
  {
    private List&lt;String&gt; myList = new ArrayList&lt;&gt;();
    public B()
    {
      super();
      init();
    }
  
    @Override
    public void init()
    {
      myList.add("apple");
    }
  }
  </code></pre>
  
  <p>I observe that in A's init(), myList is of size 0, so it was able to add "apple".
  But in B's init(), myList is null, and it throws a NPE when trying to add "apple".</p>
  
  <p>I know this might be something fundamental that I can't understand and I'd want to wrap my head around this.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: Happened to see this <a href="https://stackoverflow.com/questions/48922077/why-child-private-field-is-null-when-printing-it-from-parent-class-using-polymor">Why child private field is null when printing it from parent class using polymorphism in java?</a>
  Is it dynamic binding? I have explicitly declared my ctor, moreover it's a list, don't they get automatically initiallized to empty lists?</p>