jQuery in Action, 3rd edition
The moose likes I/O and Streams and the fly likes String & String Buffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "String & String Buffer" Watch "String & String Buffer" New topic

String & String Buffer

Jitendra Nehul

Joined: Jan 01, 2001
Posts: 3
Hello Everybody,
What is the difference between String & String Buffer.
Muhammad Ali

Joined: Dec 04, 2000
Posts: 28
String is an immutable class, i.e. the objects of this class once intialized can't change their values. In other words, there is no append method in the String class, etc.
StringBuffer on the other hand, allows various ways of manipulating, removing and inserting characters, etc.
Use String when you are sure that the characters are fix (e.g., a web page fetched from the Internet). Use StringBuffer when you have to manipulate the individual characters.
Peter Tran

Joined: Jan 02, 2001
Posts: 783
See, http://www.javaworld.com/javaworld/javaqa/2000-12/04-qa-1229-stringredux.html.
Hope this helps.
I agree. Here's the link: http://aspose.com/file-tools
subject: String & String Buffer
It's not a secret anymore!