File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GarbageCollection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "GarbageCollection" Watch "GarbageCollection" New topic
Author

GarbageCollection

G Nadeem
Ranch Hand

Joined: Apr 25, 2003
Posts: 48
hi,
ur help plz...

is the object created at line 2 elligible for GC after line 4 executes.
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Yes. Remember, Strings are immutable objects. Therefore, performing a concatenation operation creates a brand new String. It does not reference the existing Strings that were used in the concatentation.
Therefore, the object is eligible for garbage collection after line 4.
I hope that helps,
Corey


SCJP Tipline, etc.
G Nadeem
Ranch Hand

Joined: Apr 25, 2003
Posts: 48
thnx v much Corey...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GarbageCollection