I have two classes
Class A {
Suppose I use object B [say b ] in my code, and after I use it, I set it to null . I know that object B is now available for garbage collection.
I know that after setting b to null it will be immediately suitable for garbage collection? But what about an object of type A? Will it be available for garbage collection right after I set B to null ? Or will it be acceptable to collect garbage after B is a garbage collector ?
Theoretically, until B is garbage collected, does it still have a link to it? Thus, the SUN JVM compiler detects this immediately after setting b = null ;
Nik
source share