title: Calling superclass from a subclass constructor in Java
body: <p>I am trying to create a constructor that takes a field as a parameter, then puts it in a field that is stored in a superclass. Here is the code I am using</p>
  
  <pre><code>public crisps(String flavour, int quantity) {
      this.flavour = super.getFlavour();
      this.quantity = quantity;
  }
  </code></pre>
  
  <p>In the superclass I have initialised the field with </p>
  
  <pre><code>private String flavour;
  </code></pre>
  
  <p>and I have an accessor method</p>
  
  <pre><code>public String getFlavour() {
      return flavour;
  }
  </code></pre>
  
  <p>I am getting an error "<em>flavour has private access in the superclass</em>", but I believe this shouldn't matter as I am calling the accessor method that returns it to the field?</p>