why move up one level while compiling different files of same package
<p>Thanks to stackoverflow i finally understood that i need to compile from the source directory when m trying to compile a file which has a object of another class of the same package declared in one of its method. ex-  </p>

<pre><code>package p1;
public class accesslevel
{
    int n=2;
    private int pri_n=3;
    protected int pro_n=4;
    public int pub_n=5;
    public accesslevel()
    {
                System.out.print("\nin accesslevel constructor");               
        System.out.print("\nn="+n);
        System.out.print("\nprivate n="+pri_n);
        System.out.print("\nprotected n="+pro_n);
        System.out.print("\npublic n="+pub_n);
    }
}

package p1;
class samepckp1test
{
    public static void main(String args[])
    {
        accesslevel a=new accesslevel();
    }
}  
</code></pre>

<p>But i dont get why i need to do that?Can someone help me understand why i need to move one level up?</p>
