Compiler Error J0204

Cannot access protected member 'identifier' in class 'identifier' via a qualifier of type 'identifier'

The compiler detected that a class in one package, that is extending a class in another package, attempted to access a protected member of the base class using an instance of the base class. This error usually occurs when a class attempts to access members of its base class through an instance other than this, super, or an instance of the derived class. Ensure that the base class's protected member is accessed using the this or super keyword, or an instance of the derived class and compile again.

The following example illustrates this error:

/*(source located in a file called Point.java located in the Boxes package directory) */
package Boxes;

public class Point{
   protected int x, y;
   //Do other meaningful code here
}
//(source located in a file called simple.java)
import Boxes.Point;

public class Simple extends Point{
   public void method1(Point p){
      super.x = 0; //this is OK!
      p.x = 0; /*error: cannot use a protected member
                 for usage other than extending it. */
   }
}