title: how to use the variable of one class into another class using java?
body: <p>Ihave two class files. In that first file, i stored aaa class firl and in the next text file i store the class file bbb.Io want to use the variable of aaa class into bbb class. How to use use it.</p>
  
  <p>Note :If i put String value variable as public then it shows some error.</p>
  
  <pre><code>class aaa{
      public void method{
          String value="as some output";
          string other="it has some output";
      }
  }
  public static void main(String args[]){
      aaa obj=new first();
      bbb object=new second();
  }
  
  class bbb{
      aaa obj2=new aaa();
      System.out.println(obj2.value); //It gives error here also
  }
  </code></pre>
  
  <p>Please suggest ideas. Thanks in advance.</p>