title: unable to import class from user-defined package
body: <pre><code>package pkg1;
      public class demoFile1 {
  
              private int maze = 5;
              public demoFile1() {}
              public demoFile1 (int maze) {
  
                      this.maze = maze;
                      System.out.println(this.maze);
  
              }
      }
  
  package pkg2;
  import pkg1.*;
      public class demoFile2 {
              public static void main (String[] args) {
  
                      demoFile1 obj = new demoFile1 (10);
  
              }
      }
  </code></pre>
  
  <p>Here, I have created two packages <code>pkg1</code> and <code>pkg2</code>. In <code>pkg1</code>, there is a class and another class inside <code>pkg2</code> which imports the <code>pkg1</code> to initailize the former class, hence it needs to import the <code>.class</code> from <code>pkg1</code>, this produces an error when tried to call from within this sub-directory: </p>
  
  <p><code>error: package pkg1 does not exist</code> </p>
  
  <p>Please note that the program worked just fine when the <code>pkg1.demoFile1.class</code> file was imported by <code>demoFile2.class</code> from outside that sub-directory (different levels, without confining under <code>pkg2</code>) but, not when both these packages were on the same level, each having source code files and <code>.class</code> files i.e., when <code>pkg2.demoFile2.class</code> tries to import <code>pkg1.demoFile1.class</code></p>
  
  <p>Edit#1 : Folder Structure: 
  <a href="https://i.stack.imgur.com/Dbi0z.jpg" rel="nofollow noreferrer">click here</a></p>
  
  <p>What I feel is that there may have been some issue with hierarchical ordering/precedence while creating or importing the <code>.class</code> file from the package OR the overall definition(s) would have been written wrong. Please help.</p>