title: Changing variable values in subclasses?
body: <p>It's been quite awhile since I worked on anything in Java, and I really have very limited experience making anything with it at all, for the most part I write in higher level specified languages, scripting languages and the sort.</p>
  
  <p>I assume I'm not understanding the concept behind assigning the default value of a class's members.</p>
  
  <pre><code>// parent
  public class A {
      protected int value = 0;
      public void print() {
          System.out.println(value);
      }
  }
  
  // child class
  public class B extends A {
      int value = 1;
  }
  </code></pre>
  
  <p>To keep it short, creating an instance of B and calling print() prints the original value of "value" set in A.</p>
  
  <p>I assume rather than being some kind of general identifier for "a variable named 'value' owned by this object," the defined function on A has a completely different context for "value" than B does.</p>
  
  <p>What other method is there to organize common variations of a certain class but creating a child of said class? Some kind of factory object? It doesn't seem to be interfaces are the answer because then I have to redefine every single facet of the class, so I've gained nothing in doing so.</p>
  
  <p>Any help would be much appreciated, thanks.</p>