CLASS: INTRO TO PROGRAMMING USING C# The purpose of the discussion board is to d
ID: 3860046 • Letter: C
Question
CLASS: INTRO TO PROGRAMMING USING C#
The purpose of the discussion board is to discuss various topics related to the readings in order to enhance your understanding. Therefore, it is important that you read discussion board postings, don’t restate what someone has already said, try to further the discussion. It is okay to ask questions, pose ideas, and provide opinions.
Post 4 to 6 paragraphs on one of the following topic to the week 8 discussion forum
Discuss and explain the concepts of strings being immutable. What does immutable mean and how are values held in string objects changed?
Be sure to cite your references
Explanation / Answer
immutable means that you cannot change the object value. Strings are also immutable , so String values are never changed. but it's reference can be changed
How are the values held in string object changed?
String Immutable objects are stored as string literals(String pool) in heap storage. so object value can not be changed in literal but it's reference can be
e.g String s = "abc" -> here the "abc" object is created in string pool in heap area
s = "abcd" , here the "abcd" object is created in string pool in heap area,and it is assigned to s reference.
Reference: hhttps://stackoverflow.com/questions/4274193/what-is-the-difference-between-a-mutable-and-immutable-string-in-c