Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between String objects and string buffer objects

 
Venkat Ramsimha
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,
I need to know the basic difference between 'String objects' and 'Stringbuffer objects'
can anybody explain within a program the basic functionality of the both objects?

tx&best regards
venkat
 
Salvador Cecilio
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a short answer.

A string object contains a sequence of characters that cannot be changed. When you attempt to "modify" a String object, a new String Object is actually created. This is inefficient when the sequence of characters is frequently modified. The solution is to use a StringBuffer object so that changes in the sequence of characters does not require the creation of a new object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic