still confused about packages and import
My question is now more general. OK, so let's say I have two files, and they are both in a directory called "testy":
1. testy/Testy.java looks like this:
package testy;
import testy.*;
public class Testy {
public static void main(String args[]) {
System.out.println(SOME_CONSTANT);
}
}
2. and testy/Westy.java looks like this
package testy;
public class Westy {
public static final String SOME_CONSTANT = "Hello";
}
No matter what I do, I can't get Testy.java to compile. I've tried it with the package declarations and without. I've tried "import testy.*", "import testy.Westy.*" and I've tried leaving out the import statement entirely. I've tried qualifying SOME_CONSTANT as "Westy.SOME_CONSTANT", and I've tried it unqualified. I've tried compiling Westy.java first, and I've tried leaving it uncompiled, hoping that it will get compiled automatically when I compile Testy.java.
In every case, I get a compiler error "cannot find symbol: variable SOME_CONSTANT"
I should point out that all of the above combinations seem equally likely/unlikely to work to me, so I don't really understand what a package declaration is supposed to do, what an import statement is supposed to do, and when you don't have to use either statement because the external file is in the same directory as the one you're compiling.
Btw, I set my CLASSPATH to include the directory I'm working in, but that didn't change anything. Also I don't understand why I need to worry about CLASSPATH when all of my source files are in the same directory.
How would you get this to compile?
My ultimate goal is to split my source code into different files just to keep things organized. Is that possible? Not everything will be a static member so I don't think the "import static" functionality is right for me.
Grateful for any light in this fog.