Hi All,
I have a class pack in a package packed as follows
package packed;
public class pack
{
static public int x1 = 7;
static protected int x2 = 8;
static int x3=9;
static private int x4 =10;
}
An other class
Test in a different package
import packed.pack;
class test extends pack
{
public static void main(
String args[] )
{
pack p = new pack();
System.out.println( pack.x2 );
}
}
If i remove static from protected variable x2, i am getting a compiler error that x2 is not visible.Why is it so?
As per the API, i should be able to access the protected variables in or outside the package using inheritance.