Given the following directory structure:
/top
|--- wrk
|--- pkg
|--- A.java
|--- B.java
As
The compiler has to either find and successfully compile a source for B, or find a .class for B even if it's just an import. As opposed to loading, which is done dynamically.
Look in your output directory and you'll see that B has been compiled as well. It will be compiled even if in a different package, but you'll have to make it public to reference it from A.