Let's take a look at a protected instance variable of a superclass. : protected « Modifiers « SCJP






package certification;
public class Parent {
   protected int x = 9; // protected access
}

x is accessible to all other classes inside the certification package, 
as well as inheritable by any subclasses outside the package. 

package other; // Different package
import certification.Parent;
class Child extends Parent {
   public void testIt() {
      System.out.println("x is " + x); // No problem; Child inherits x
   }
}








3.5.protected
3.5.1.protected features are even more accessible than default features.
3.5.2.Let's take a look at a protected instance variable of a superclass.
3.5.3.Child class accesses the protected variables through inheritance, not accessing it through a reference to an instance of the superclass.