Pergunta de entrevista da empresa Goldman Sachs

Is a string mutable?

Respostas da entrevista

Sigiloso

16 de mai. de 2016

No

Sigiloso

2 de fev. de 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.