[Solved] Clarification needed regarding immutability of strings in Python [closed]

In CPython, ids relate to where in memory the string is stored. It does not indicate anything about mutability. How memory is used exactly is an internal implementation detail. You could of course do a deep dive into the internals of CPython’s memory management to disentangle that in-depth, but that’s not really useful. (Im)mutability can … Read more

[Solved] Is Java String immutable? [duplicate]

Yes, the java string is immutable. In changeString, you are passing in a reference to the string lalala and then you are changing the reference to one that points to lalalaCHANGE!!!. The original string object is not changed, and the reference in main still refers to that original object. If you were to use a … Read more

[Solved] Are all immutable objects singleton instances? [closed]

No. Immutable objects are unchangeable, the normal practice for these is to pass (inject) all required values via the constructor (i.e. they are specified when the object is instantiated), these are then externally unchangeable for the lifetime of the object. Singleton objects are when there is a single instance, that instance could be immutable but … Read more