File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes reg: string and stringbuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "reg: string and stringbuffer" Watch "reg: string and stringbuffer" New topic

reg: string and stringbuffer

sri charan

Joined: Dec 04, 2007
Posts: 14
Hello friends,

I just want to know if the "stringbuffer" is giving more flexibuility for data store then why in most case's we go for "string"

can any one please confirm this......
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46362
Don't use StringBuffer any more; use StringBuilder.

String is used because its objects are immutable, so they can be reused without using too much memory, or threading problems.

StringBuilder is used because it gives a fast way of altering the contents of String-like text.
I agree. Here's the link:
subject: reg: string and stringbuffer
It's not a secret anymore!