Confusion regarding Java Packages and Windows Directory?
<p>When preparing for the SCJP exam, we were going through the following code: </p>

<pre><code>package certificaton;    
public class OtherClass    
{    
 public void testIt()    
  {    
     System.out.println("otherclass");    
  }    
} 
</code></pre>

<p>And this: </p>

<pre><code>package somethingElse;    
import certification.OtherClass;    
public class AccessClass    
{    
   public static void main( String args[])    
   {    
       OtherClass o= new OtherClass();    
       o.testIt();    
   }    
}
</code></pre>

<p>I placed both the above files in the following directory: C:\scjp\temp8 ; and the strange thing is that, the .java files are compiling and results in two .class files being created in the same directory. The thing I want to ask, is that, the difference between packages and directory. Isn't it true that the class files could be created in a directory other than the one stated in the package declaration? And the package declaration is something 'virtual', and disregards the windows directory structure. In addition, isn't it also true that, by executing the following command: </p>

<pre><code>javac -d . OtherClass.java 
</code></pre>

<p>The directories are created conforming to the package declaration, which isn't always mandatory?</p>
