Siva,
my 2 cents :
Have you put two files under the abc.xyz directory then compile the files ?
In the two files, your code creates a cause-result chain reaction between the two classes.
//when you compile either one of them, compiler looks for the other.
eg : when you compile Yax.java, compiler encounter Nax n = new Nax(); it then look for Nax inside the package you defined -> abc.xyz if compiler can not find Nax class it issue a error.
Originally posted by Siva rarayana:
Hi everybody,
I have created following two classes and trying to compile.While compiling I am getting compilation errors.
Yax.java
--------
package abc.xyz;
public class Yax{
Nax n = new Nax();
public void abc()
{
System.out.println(" Yax");
}
}//eof Yax.java
Nax.java
----------
package abc.xyz;
public class Nax{
Yax n = new Yax();
public void abc()
{
System.out.println(" Nax");
}
}//eof Nax.java
the compilation command is
c:\test>javac -d . Yax.java
Now I am getting the following error
Yax.java:5: cannot resolve symbol
symbol : class Nax
location: class abc.xyz.Yax
Nax n = new Nax();
^
Yax.java:5: cannot resolve symbol
symbol : class Nax
location: class abc.xyz.Yax
Nax n = new Nax();
^
2 errors
If you compile with *.java it is ok.There will be no error.
please clarify it.
thankx and rgds,
siva
[ January 30, 2003: Message edited by: chi Lin ]