title: No enclosing instance of type test is accessible. Must qualify the allocation with an enclosing instance of type test error on a simple test Program
body: <p>I got the No enclosing instance of type test is accessible. Must qualify the allocation with an enclosing instance of type test error with <code>Location ob1 = new Location(10.0, 20.0);</code> I'm not sure why..</p>
  
  <pre><code>package pkg;
  
  public class test {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          Location ob1 = new Location(10.0, 20.0);
          Location ob2 = new Location(5.0, 30.0);
          ob1.show();
          ob2.show();
          ob1 = ob1.plus(ob2);
          ob1.show();
          return;
      }
  
      public class Location // an ADT
      {
          private double longitude, latitude;
  
          public Location(double lg, double lt) {
              longitude = lg;
              latitude = lt;
          }
  
          public void show() {
              System.out.println(longitude + " " + latitude);
          }
  
          public Location plus(Location op2) {
              Location temp = new Location(0.0, 0.0);
              temp.longitude = op2.longitude + this.longitude;
              temp.latitude = op2.latitude + this.latitude;
              return temp;
          }
      }
  }
  </code></pre>