From my understanding, garbage collection in Java cleans up some objects if nothing else is \'pointing\' to that object.
My question is, what happens if we have some
Garbage collection doesn't usually mean "clean some object iff nothing else is 'pointing' to that object" (that's reference counting). Garbage collection roughly means finding objects that can't be reached from the program.
So in your example, after a,b, and c go out of scope, they can be collected by the GC, since you can't access these objects anymore.