posted 24 years ago
Depends on how you are doing it. For example if you had this:
Then yes, once s is concatentated with t, the original String "java" is elgible for garbage collection.
However if you did this:
or
Then no, the String "java" is not eligble for garbage collection since s still points to it. Strings are immutable, so unless you say s now equals something else, the original String referenced by s is still there and you are still able to get to it.
Bill
[This message has been edited by bill bozeman (edited January 26, 2001).]