170k views
2 votes
String objects are immutable. This means they ________.

a. must be initialized
b. cannot be deleted
c. cannot be changed
d. None of the above

User Waratuman
by
8.7k points

1 Answer

0 votes

Final answer:

String objects are immutable, which means they cannot be changed after they are created; instead, operations create new string objects.

Step-by-step explanation:

When we talk about string objects being immutable in programming, it means they cannot be changed once they have been created. This doesn't mean they can't be deleted or must be initialized in any particular way; rather, any operation that seems to change a string actually creates a new string object. For example, when concatenating two string objects, the result is a new string object, not a modification of either original string. Any operation that changes the value of a string object will create a new string object instead of modifying the original one.

User Jonathan Dunlap
by
9.4k points