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
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.