public class Test03 {
public static void main(String[] args) {
第一题
String s1 = "abc";
String s2= "abc";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
//第二题:有几个对象
// String s1 = new String("abc");
//第三题
String s1 = new String("abc");
String s2 = "abc";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
//第四题
/* String s1 = "a" + "b" + "c";
Staaq ring s2 = "abc";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
//第五题
String s1 = "ab";
String s2 ="abc";
String s3 =s1 +"c";
System.out.println(s2 == s3);
System.out.println(s2.equals(s3));
}
}
|
|