Goldman Sachs interview question

Is a string mutable?

Interview Answers

Anonymous

16 May 2016

No

Anonymous

2 Feb 2017

I'm assuming that "string" in this context means an instance of the Java String class. Even if it referred to an analogous structure in Python, C, or C++, the answer would still be No. If you want to modify a string in any one of those languages, you would first need to release that a string is just syntactic sugar for a char array. Convert your string to a char array, make your adjustments, and then convert back to a string.