On which line would 'str' be garbage collected? If you mean the
String object created on line 5 created with new, when it would be
eligible for garbage collection, that would be line 8 because at that point there are no longer any reachable references to it. Of course you realize that two String objects are created on line 5, one of which will not be garbage collected because it is placed in the pool of String literals.
[ March 02, 2004: Message edited by: Michael Morris ]
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher