This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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
Hope this helps.
Consider Paul's rocket mass heater.
subject: String & String Buffer