Frage im Vorstellungsgespräch bei Goldman Sachs

Is a string mutable?

Antworten zu Vorstellungsgespräch

Anonym

16. Mai 2016

No

Anonym

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.