String s1 =" hello" ; S1 = QUOT;的HelloWorld" sop(s1)如果s1在java中是不可变的,s1值将如何变化

问题描述:

String s1 =hello; s1 =helloworldsop(s1)如果s1在java中是不可变的,s1值将如何变化



我想要上面的答案详细解释

String s1= "hello" ; s1="helloworld" sop(s1) how s1 value will be change if s1 is immutable in java

I want above answer with details explanation

变量s1不是不可变的;你可以随时将这个变量重新生成一个新的字符串。



字符串hello和helloworld是不可变的;但你在你的问题中反驳了字符串和变量。
The variable s1 is not immutable; you can reaffect this variable to a new string anytime you want.

The strings "hello" and "helloworld" are immutable; but you counfound the string and the variable in your question.