String.replace result is ignored?

后端 未结 4 814
死守一世寂寞
死守一世寂寞 2021-01-20 13:20

So i\'m using IntelliJ and the replace buzzword is highlighted. Most of the tips are over my head so i ignore them, but what i got for this one was that the result of string

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-20 14:04

    String objects are immutable.

    From the docs:

    public String replace(char oldChar,char newChar)

    Returns a string resulting from replacing all occurrences of oldChar in this string with newChar.

    Hope this helps.

提交回复
热议问题