title: Assigning String to a final String
body: <p>I have a few classes like this:</p>
  
  <pre><code>public class A {
      private String foo;
  
      public A(String f) {
          foo = f; // I want foo to be final based on the subclass instance
      }
  }
  
  public class B extends A {
      private static final String FOO = "foo1";
  
      public B() {
          super(FOO);
      }
  }
  
  public class C extends A {
      private static final String = "foo2";
  
      public C() {
          super(FOO);
      }
  }
  </code></pre>
  
  <p>What I want is when I create an object on type <code>B</code>, I don't want the <code>String</code> in <code>A</code> to be changeable. <code>foo = f</code> just assigns a reference but I want <code>foo</code> to be the same final object <code>FOO</code>. How can I do this?</p>