• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

String & String Buffer

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everybody,
What is the difference between String & String Buffer.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
------------------
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jitendra,
See, http://www.javaworld.com/javaworld/javaqa/2000-12/04-qa-1229-stringredux.html.
Hope this helps.
-Peter
 
reply
    Bookmark Topic Watch Topic
  • New Topic