title: Is there a way to access the variables/fetch the assigned values of the caller class in a method of the called class?
body: <p>This is similar to the question :
  <a href="https://stackoverflow.com/questions/9396604/is-there-a-way-to-access-the-variables-of-the-calling-class-in-a-method">Is there a way to access the variables of the calling class in a method?</a>
  But I am not quite able to get the exact answer.
  What I am trying to do: </p>
  
  <pre><code>class A{
      m()
      {
          int a=8;
          new B.m1();
  
      }
  }
  
  class B{
      m1()
      {
           //Print the value of a of class A (i.e 8) here     
      }
  }
  </code></pre>
  
  <p><strong>Constraints:</strong> <em>Nothing in class A should be changed.Changes to be made in class B only! (such as putting B.m1(this) in class A etc. )</em></p>