object is eligible for gc when all it's references are set to null.
for e.g.
String str = new String("hi");//1
String str1= str;//2
str=null;//3
:
://some processing with str1
:
:
str1=null;//4
Here we have created a new object str which contains a string "hi"
now we r assigning that to str1. so now there r 2 references to string "hi".
So unless and until u are not making both str and str1 to null that object is not eligible for garbage collection.