title: In Java, why can't I declare a final member (w/o initializing it) in the parent class and set its value in the subclass? How can I work around?
body: <p>In a Java program, I have multiple subclasses inheriting from a parent (which is abstract). I wanted to express that every child should have a member that is set once only (which I was planning to do from the constructor). My plan was to code s.th. like this:</p>
  
  <pre><code>public abstract class Parent {
      protected final String birthmark;
  }
  
  public class Child extends Parent {
      public Child(String s) {
          this.birthmark = s;
      }
  }
  </code></pre>
  
  <p>However, this seems to not please the Java gods. In the parent class, I get the message that <code>birthmark</code> "might not have been initialized", in the child class I get "The final field <code>birthmark</code> cannot be accessed".</p>
  
  <p>So what's the Java way for this? What am I missing?</p>