'Does Composite object's reciprocal relationship cause memory leak in java [duplicate]

Suppose we have following case. Should we face any memory leak here?

class A {
   B b;
   void set(B in) { b = in; }
}

class B {
  A a;
  void set(A in) { a = in; }
}

void main() {
   A ina = new A();
   B inb = new B();
   ina.set(inb);
   inb.set(ina);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source