• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reg: string and stringbuffer

 
sri charan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

I just want to know if the "stringbuffer" is giving more flexibuility for data store then why in most case's we go for "string"

can any one please confirm this......
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use StringBuffer any more; use StringBuilder.

String is used because its objects are immutable, so they can be reused without using too much memory, or threading problems.

StringBuilder is used because it gives a fast way of altering the contents of String-like text.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic