I have a theoretical question I can't find an answer to -
Assuming I have a singelton instance A with inner private member a and a public
setter, now let's assume I set this member from another instance of
class type B in a private method as a consequence to some event
i.e. if something happen I will call A.setA(a) from B's private method.
My question is - 
Once the use in instance of class B is over and the instance of class A still "lives" in the system,
will the instance of class B get garbage collected? 
That is if B use anonymous member to init A's a.
Thanks in advance.
Edit - Code example -
public class A {
    Object a;
    public void setA(Object a) {
        this.a = a;
    }
}
public class B {
    private void foo() {
        if(...condition) {
            A.getInstance().setA(new Object());
        }
    }
}
To further explain - the instance of class A is a singleton in the system, there is no other class referencing to the instance of class B and it's done it's part after setting A's private member
 
     
    