Anurag Malaviya wrote:how can we know whether object e1's reference variable e is null or not after we set e1=null
When an object reference variable is set to null, there's no way to check anything about its member variables, because they go out of scope.
e.g. If an array is null, there is no point in checking if its 'length' is null or not. you anyway can't access it.
If this is related to garbage collection question (I think so), then all
you should worry about is - is there at least one reference to that particular object or not.
I hope this helps.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)