将字符串S使用replaceAll方法后,输出s仍未替换

来源:互联网 发布:怎么连接kad电骡网络 编辑:程序博客网 时间:2024/06/06 16:31
replace方法并不能改变字符串本身的,只是replace方法能返回一个处理后的字符串而已,例如:String s="hello";System.out.println(s.replace("h","H"));System.out.println(s);输出结果:Hellohello
0 0
原创粉丝点击