Is “new String()” immutable as well?

后端 未结 15 2485
日久生厌
日久生厌 2020-12-12 23:43

I\'ve been studying Java String for a while. The following questions are based on the below posts

Java String is special
Immutability of String in java

15条回答
  •  天涯浪人
    2020-12-13 00:18

    1-String is immutable.See this:

    Is a Java string really immutable?

    So you can create it with many way.

    2-Short answer: Yes will be empty.

提交回复
热议问题