Hello All,
I have a series of questions on packages....I am trying out certain things practically with my compiler and couldn't proceed much..help me out...Although, I have done some decent
java projects, i haven't encountered much with PACKAGES or else
IDE which I am will be using will take careof all abt. packages....okay, enuf of background stories;;;; lemme COME TO THE POINT...!!
i want to create 2 java files each under separate PACKAGES and
test the access of protected/default & public members from one package to the other!! (both as subclass and as a non-subclass)..
I'm testing the progs. on a UNIX based system. I did create files with the following source code::
file 1::
package parent;
class protect1
{
void test1()
{
System.out.println("AM IN PARENT - protect1.java");
}
}
file2::
package child;
import parent.*;
public class protect2 extends protect1
{
public static void main(
String[] args)
{
protect2 p2 = new protect2();
p2.test2();
}
void test2()
{
test1();
}
}
Should I necessarily need to create separate directories for each of the package or how should I go about executing this.....HELP OUT !!....
Any help is APPRECIATED !!
~ Shalini