File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes asking about StringBuffer memory location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "asking about StringBuffer memory location" Watch "asking about StringBuffer memory location" New topic
Author

asking about StringBuffer memory location

kumar abhay
Ranch Hand

Joined: Oct 02, 2001
Posts: 53
hi there,
i hope u ppl r doin' fine.i have a question regarding string buffer.All string laterals r saved in pool but StringBuffer in not saved in pool.
Q.1 where stringbuffer is saved?
Q.2 y it does not save in pool does it have any other memory location n y it is categorized to be saved at a different place.
i m sure that u ppl will replay me asap.thanx in advance.
take care
with regards
kumar abhay
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Kumar,
The string pool is a place in memory that doesn't ever get changed. Items can be inserted into and removed from it (by compiler and gc) but the item contents are all immutable.
Strings are saved in a pool because they are immutable. That means that once created they can't be changed.
StringBuffers on the other hand can be changed. That is why they aren't saved in the String pool.
Regards,
Manfred.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
They are created out on the heap where most objects exist.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
Thank You Manfred now its clear.
kumar abhay
Ranch Hand

Joined: Oct 02, 2001
Posts: 53
hi there,
tahnks alot for solving my problem n your kind concern regarding my problem.i hope that your help will be continued in the future as well.
take care
with regards
kumar abhay
 
 
subject: asking about StringBuffer memory location