package one; public class A { // has implied default constructor protected int p; } //////////////////////////////// package two; import one.A; class B extends A { void myMethod() { p = 1; // ok A a = new A(); a.p = 1; // not ok, p would have to be public for this to work. } }