posted 23 years ago
hi,
In case, u need more explanation, then u can read the following. I have tried to explain it in a simple way.
Object a = new Object();
Object b = new Object();
Object c = new Object();
Object d = new Object();
Imagine that the Object reference variable "a" refers to an Object Ob1.
Similarly, "b" refers to an Object Ob2. "c" refers to an Object
Ob3. "d" refers to an Object Ob4.
After the statement, d=c=b=a
"a" still refers to Ob1.
"b" also refers to Ob1.
"c" also refers to Ob1.
"d" also refers to Ob1.
So the objects Ob2, Ob3 and Ob4 are left unreachable(not used). That makes the 3 (Ob2,Ob3,Ob4) Objects eligible for garbage collection.
Hope this will do.
All the best
regards
nidiya