I have created 2 packages pkg1 and pkg2, my directory structure is :
c:\ABC\pkg1
c:\ABC\pkg2
I have created a file TestProtectedSuper.java in pkg1 and TestProtectedSub.java in pkg2
when I am individually compiling and running pkg1.TestProtectedSuper it is running fine, but when I am trying to use this file in pkg2.TestProtectedSub.java,
getting compilation error :
package pkg1 does not exist
cannot fine symbol for class TestProtectedSuper
code for TestProtectedSuper.java :
package pkg1;
public class TestProtectedSuper
{
protected int age;
public TestProtectedSuper(int ag)
{
age=ag;
}
package pkg2;
import pkg1.TestProtectedSuper;
public class TestProtectedSub
{
public static void main(String[] args)
{
System.out.println("Testing Protected Variable in different package");