|
-
May 15th, 2005, 02:02 PM
#4
Dazed Member
Re: Which is worse?
Java treats string of the same content to be of the same ref. So in essence i guess they share the same memory location. Since you said your Strings are going to constantly change you will be in effect creating a new object for each new String. As lemenz70 pointed out the Garbage Collector will clean up any unused objects but you will probably get a performance hit though. You are better off just using a StringBuffer and set it's length to zero when you want to clear it out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|