I have a class called A in package1 and another class called C in package2. Class C extends class A.
A has an instance variable which is declared like this:
<
public void go(){
//remember the import statement
A a = new A();
System.out.println(a.publicInt);
System.out.println(a.protectedInt);
}
When you are doing A a = new A();
and a.protectedInt
you trying to access protected member of A which is illegal according to java standards
Instead you can do this.protectedInt
directly.