how to reference an instance created in another class
<p>I have a function in Class A which I would like to change the value of a field in Class B.</p>

<p>Class C has my <code>main()</code> and creates a new instance of class B and Class A. Class A is from an API and one of their functions is a listener function. I would like for that listener function to be able to change the field of Class B, but when I write the code for the listener function, it doesn't recognize Class B's instance. </p>

<p>How do I reference that instance?</p>

<p>Example code:</p>

<pre><code>public class A {
     public void listenermethod(){
            //can't reference Binstance &lt;-------
     }
}

public class B {
     B.field = 1;
}

public class C {
     A Ainstance = new A();
     B Binstance = new B(); 
}
</code></pre>
