title: Java abstract class: protected fields or public set/get methods
body: <p>If I got an abstract class that I'm intended on creating sub classes from, is it better practice to have the fields in the abstract class to be protected or have the sub classes use setters and getters instead? Are there any pros and cons?</p>
  
  <p>For instance:</p>
  
  <pre><code>public abstract class MyAbstractClass {
      // option A
      protected int myProtectedInt;
  
      // option B
      private int myPrivateInt;
      public void setMyPrivateInt() {}
      public int getMyPrivateInt() {}
  }
  
  public class MySubClass extends MyAbstractClass {
      // etc
  }
  </code></pre>