您的位置:首页 > 其它

字符串答疑

2015-12-14 19:04 429 查看
public class TestString {
@Test
public void ch() {
String s1 = new String("amit");
String s2 = s1.replace('m', 'r');
String s3 = "arit";
System.out.println(s2 == s3);
}

public static void changeStr(String s) {
s = "welcome";
System.out.println(s);
}

public static void main(String[] args) {
String str = "abcd";
changeStr(str);
System.out.println(str);
}

}
test测试方法打印结果是false。

main方法打印结果是:

welcome

abcd
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: