Yes, you're correct. The class used by Randomclass should be in directory C:\Java (in subdirectories if the class has a package).
Also... there's always another way.
If both class' source code are made by you, you could compile them all in one go. e.g. C:\Java> javac -d . *.java
That way the compiler will resolve dependecies itself... it will compile classes used by others first. Of course, you cannot do that when you don't have all the source code... and that will recompile *all* source code, which could really take a while if your project is huge.
Oh by the way, I think I should tell you about this too: static final members.
Say we have these two classes:
==== ClassOne.java ====
package test;
public class ClassOne {
public static final String MESSAGE = "Hello, world!";
public static void main(String[] args) {
System.out.println(MESSAGE);
}
}
==== End ClassOne.java ====
==== ClassTwo.java ====
package test;
public class ClassTwo {
public static final String MESSAGE = ClassOne.MESSAGE;
public static void main(String[] args) {
System.out.println(MESSAGE);
}
}
==== End ClassTwo.java ====
Then try these:
C:\> javac -d . *.java
C:\> java test.ClassOne
Hello, world!
C:\> java test.ClassTwo
Hello, world!
Now we modify ClassOne.java, changing the constant MESSAGE.
==== Modified ClassOne.java ====
package test;
public class ClassOne {
public static final String MESSAGE = "Goodbye, world.";
public static void main(String[] args) {
System.out.println(MESSAGE);
}
}
==== End Modified ClassOne.java ====
Then test again, but this time, only compile ClassOne.java:
C:\> javac -d . ClassOne.java
C:\> java test.ClassOne
Goodbye, world.
C:\> java test.ClassTwo
Hello, world!
You'll see the data inside ClassTwo isn't updated. That's because when compiling, the compiler translates static final members into literal values (to reduce generated code size and increase performance).
Therefore, if you have some static final members used by more than one classs, you'll have to recompile them all when the static finals have changed.
Also... there's always another way.

If both class' source code are made by you, you could compile them all in one go. e.g. C:\Java> javac -d . *.java
That way the compiler will resolve dependecies itself... it will compile classes used by others first. Of course, you cannot do that when you don't have all the source code... and that will recompile *all* source code, which could really take a while if your project is huge.
Oh by the way, I think I should tell you about this too: static final members.
Say we have these two classes:
==== ClassOne.java ====
package test;
public class ClassOne {
public static final String MESSAGE = "Hello, world!";
public static void main(String[] args) {
System.out.println(MESSAGE);
}
}
==== End ClassOne.java ====
==== ClassTwo.java ====
package test;
public class ClassTwo {
public static final String MESSAGE = ClassOne.MESSAGE;
public static void main(String[] args) {
System.out.println(MESSAGE);
}
}
==== End ClassTwo.java ====
Then try these:
C:\> javac -d . *.java
C:\> java test.ClassOne
Hello, world!
C:\> java test.ClassTwo
Hello, world!
Now we modify ClassOne.java, changing the constant MESSAGE.
==== Modified ClassOne.java ====
package test;
public class ClassOne {
public static final String MESSAGE = "Goodbye, world.";
public static void main(String[] args) {
System.out.println(MESSAGE);
}
}
==== End Modified ClassOne.java ====
Then test again, but this time, only compile ClassOne.java:
C:\> javac -d . ClassOne.java
C:\> java test.ClassOne
Goodbye, world.
C:\> java test.ClassTwo
Hello, world!
You'll see the data inside ClassTwo isn't updated. That's because when compiling, the compiler translates static final members into literal values (to reduce generated code size and increase performance).
Therefore, if you have some static final members used by more than one classs, you'll have to recompile them all when the static finals have changed.