Hello Everyone,
My name is Sunil and I am preparing for
SCJP 5.0.
I need help in running the following program.
SOURCE FILE 1:-
package Sunil_programmer.A;
public interface
Test {
void go();
}
SOURCE FILE 2:-
package Sunil_programmer.B;
import Sunil_programmer.A.*;
class Test1 implemets Test
{
public static void main(
String[] args)
{
Test1 t=new Test1();
t.go();
}
public void go()
{
System.out.println("Hello Java");
}
}
NOW THE PROBLEM:-
I have created a directory Sunil_Programmer in C partition in windows.
In Sunil_programmer I created two directories named A and B. In
directory A there is SOURCE FILE 1 and in directory B there is SOURCE
FILE 2. I want to compile and run SOURCE FILE 2. I have navigated to directory A and compiled SOURCE FILE 1 and it compiles successfully. Then I navigated to directory B and tried to compile SOURCE FILE 2 having class Test1 implementing interface Test. The class Test1 is in package B and interface is in package A. I have not set classpath expicilty as an Environment Variable.
I am getting two errors given below while compiling class Test1.
1. Sunil_Programmer.A.*; Package A does not exist.
2. Error: Test1 implements Test
I think it is a package access and classpath problem, But I am unable to sort it out.
Please help me in detail in this problem.
With best Regards!
Sunil Kumar
SCJP Aspirant.