title: Access a private variable from the superclass (JAVA)
body: <p>Ok so I have studied java all semester and thought I had a clear understanding about inheritance and super/sub classes. Today we were given as assignment for making a superclass called enemy, with sub classes of different types of enemies.  I did everything fine and all of my subclasses are working, but when I went back to read the guidelines we must follow, I found this sentence: </p>
  
  <blockquote>
    <p>"All member variables of the super class must be private. Any access to a variable must be done through protected methods in the subclasses."</p>
  </blockquote>
  
  <p>From what I have learned, this makes no sense to me.  If a variable is private within the superclass, doesn't that disallow access even from a subclass?  The last part that talks about protected methods in the subclasses also doesn't make any sense to me. How does this help and/or allow any access whatsoever to the super class?</p>
  
  <p>From what I've learned about inheritance, Below is what i thought was true:</p>
  
  <pre><code>                Access Levels
   Modifier    Class  Package Subclass    World
   public        Y      Y        Y        Y
   protected     Y      Y        Y        N
   no modifier   Y      Y        N        N
   private       Y      N        N        N
  </code></pre>
  
  <p>If I'm understanding something wrong here please do explain! I don't want to confront the instructor about giving us faulty instructions, if I'm the one not understanding it correctly!</p>