Cannot access protected member 'identifier' in class 'identifier' from class 'identifier'
The compiler detected an attempt to access a protected member from a class in a different package. A protected member of a class may be accessed from outside the package in which it is declared only by code that is responsible for the implementation of that class. Remove the call to the other package's protected member or make your class a subclass of the other package's class and compile again.
The following example illustrates this error:
/*(source located in a file called PublicClass.java in
the the Boxes Package directory) */
package Boxes;
public class PublicClass{
protected void method1(){
//Do something here
}
}
//(source located in a file called Simple.java)
import Boxes.PublicClass;
public class Simple extends PublicClass{
public void method1(){
PublicClass pub = new PublicClass();
pub.method1();
/*error: Cannot access protected method 'method1' because it
is located in a different package.*/
}
}