Goldman Sachs Interview Question

Is a string mutable?

Interview Answers

Anonymous

May 16, 2016

No

Anonymous

Feb 2, 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.