Q33. Why Strings in Java are called as Immutable?
In java, string objects are called immutable as once value has been assigned to a string, it can...
Q33. Why Strings in Java are called as Immutable?
In java, string objects are called immutable as once value has been assigned to a string, it can't be changed and if changed, a new object is created. True False
As strings em Java são chamadas de imutáveis porque, uma vez que um valor é atribuído a uma string, ele não pode ser alterado. Se você tentar modificar uma string existente, na verdade será criado um novo objeto de string com o valor modificado. Portanto, a afirmação "True" é correta.
0
0
Faça como milhares de estudantes: teste grátis o Passei Direto
Compartilhar