title: Unable to place an Object of java class in another class
body: <p>i have two java classes in a package. I want to create one class's object into another but it gives an error message ERROR: cannot find symbol. </p>
  
  <pre><code>package pckg;
  public class aa{
     private String name;
     public aa(){} //Constructor of aa class
     public void setName(String name){this.name=name;}
     public String getName(){return name;}
  }
  
  package pckg;
  public class bb{
     aa obj = new aa(); //This line gives error message
  
     public bb(){} //Constructor of bb class
  
  } 
  </code></pre>
  
  <p>both classes are in a same folder pckg.</p>
  
  <p>ERROR Message:</p>
  
  <pre><code>D:\Java\mypack&gt;cd..
  
  D:\Java&gt;cd pckg
  
  D:\Java\pckg&gt;set path=d:\java\jdk1.5\bin
  
  D:\Java\pckg&gt;javac aa.java
  
  D:\Java\pckg&gt;javac bb.java
  bb.java:3: cannot find symbol
  symbol  : class aa
  location: class pckg.bb
  aa obj = new aa(); //This line gives error message
  ^
  bb.java:3: cannot find symbol
  symbol  : class aa 
  location: class pckg.bb
  aa obj = new aa(); //This line gives error message
              ^
  2 errors
  </code></pre>