private static void demo4() {
String s1 = "a" + "b" + "c";
String s2 = "abc";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
}
----------------------------------------------------
private static void demo3() {
String s1 = new String("abc");
String s2 = "abc";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
}
--------------------------------------------
//创建了几个对象?
private static void demo2() {
String s1 = new String("abc");
System.out.println(s1);
}
我看了,感觉怎么有点不知道怎么做啊,完全搞不懂这个String是怎么运算的啊,求大神详细说下啊 |
|