| 1. |
Why Is String Called Immutable Data Type? |
|
Answer» A STING REPRESENTS text and stores a sequential collection of characters in the memory. A string object is said to be immutable (read only), because a value once ASSIGNED to a string object cannot be changed after the acting object has been created. When the value In the string object is modified, a new string object is created with a new value assigned to the string object therefore, keeping the old string In memory for GARBAGE collector to be disposed. A sting represents text and stores a sequential collection of characters in the memory. A string object is said to be immutable (read only), because a value once assigned to a string object cannot be changed after the acting object has been created. When the value In the string object is modified, a new string object is created with a new value assigned to the string object therefore, keeping the old string In memory for garbage collector to be disposed. |
|