posted 17 years ago
what is eligible for GC is object not reference variables. c3 has never point to an object. There are two objects of CardBoard type, each of which have a reference to a Short object. Therefore, There are 4 objects. c2 is not assigned to null although cb is because cb only have c2's value when c1.go(c2) is called. cb and c2 are defined in different methods. At last, there are only two objects are eligible for GC, one object of type CardBorad referenced by c1 originally (now c1 is null) and the other object of type Short referenced by the former object. These two objects are isolated island now
Best Wishes,<br /> Yeming