• Post Reply Bookmark Topic Watch Topic
  • New Topic

about the javaString  RSS feed

 
Santosh Maskar
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
What is this mutable String means
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Santosh Maskar:
hi
What is this mutable String means


It doesn't mean anything. Strings are immutable. I am including three URLs that I think might be useful to you.

Strings and String Buffers .

String API Doc

StringBuffer API Doc
 
Oneal Shaha
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
There is nothing like mutable strings in java. Strings are Immutable.
This means that once you assign a String value to the object of class String then it is stored to some memory location. And the data at that location never change as long as the object is pointing it.

When you assign another string value to that object it is simply stored in ohter memory location instead of over writing the previous one...
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Oneal Shaha:
Hi,
This means that once you assign a String value to the object of class String then it is stored to some memory location.


I'm sorry...I don't mean to step on your reply but...the very moment you include any sequence of characters within the " ", you are essentially creating a new String objects. There is nothing like you are assigning a value to a String object. This is the reason why operations like the one below are expensive when it comes to performance:



No offense Oneal!
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vijayendra V Rao:
you are essentially creating a new String objects


Correction! you are essentially creating a new String object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!