title: Is an object garbage if it is referenced only from garbage?
body: <p>Suppose there is an object a of class A, which holds a reference to another object b of class B. And this is the only reference to b. So now, if all references to a is removed, then a is ready to GC. Does this mean that b is also ready to get garbage collected? because, though b has a reference ( inside a ), it is unreachable, because a is unreachable. </p>
  
  <p>So how exactly does this scenario works? I mean the order of garbage collection.</p>