Hi Everyone,
I have a question regarding the proctected modifier..
--------------
package packed;
public class pack
{
static public int x1 = 7;
protected int x2 = 8;
static int x3=9;
static private int x4 =10;
}
----
import packed.pack;
class test3 extends pack
{
public static void main(
String args[] )
{
pack p = new pack();
System.out.println(p.x2);
}
}
I got an error saying that x2 is not visible on line "System.out.println(p.x2);" of test3 class.
I thought the protected modifier on variables would mean that subclasses and classes in the same package would have access to the protected variable of the parent class?
Thanks
Stephen