阅读背景:

字符串是不可变的,然后replace()如何工作?

来源:互联网 

I was trying to replace the first letter/char of a string by it's last one and last one by it's first one. E.g. abcd => dbca. Strings are immutable in Java then how can we explain the behavior of this program? Please have a look at final output. str1 has no char 'a' but in final output it appears unexpectedly.. how? //The argument of frontBack() is String "abcd".I was trying to replace the first letter/char o




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: