AS soon as you set obj=null, the object being referenced by obj is eligible for garbage collection. However the JLS does NOT specify how garbage collection is to be implemented. Hence some JVM's may choose to garbage-collect the object after the method returns, while some may immediately garbage-collect it. From the stand-point of the
SCJP, the object is eligible for gc as soon as you set it's reference to null.