Hi all, when it comes to practising "garbage collection" concepts, is there anyway we can verify which objects have been garbage collected (say via System.out.println or something equivalent)?
The following code is to
test if the objects have been garbage collected before the main method ends:
My current understanding is the makeObj() method created ObjA.
ObjA has a reference of type ObjB (named b) which points to the ObjB created by ObjA.
ObjB in turn, points to ObjA. But nothing else points to this two objects (they point to each other). Therefore they can be garbage collected.
So are these two objects eligible for garbage collection after the makeObj method ends or after the main method ends?
[ July 22, 2006: Message edited by: Shanel Jacob ]