File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

String & String Buffer

Jitendra Nehul
Greenhorn

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

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
Bartender

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