What is mutable and immutable. Difference between string vs sting builder

Share the joy
  •  
  •  
  •  
  •  
  •  
  •  
  •  

When u change the value of Mutable objects the new memory is created and new value is stored in new memory.But in immutable the value is changed in same memory, this makes immutable objects to increase the performance.so in case if the string is frequently changed in the code at run time, it is advisable to use immutable objects.

string vs string builder: String is mutable whereas string.builder is immutable.


Share the joy
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.