class Example5_8{
    public static void main(String[] args) {
        String s1, s2, s3, s4, s5, s6;
        s1 = new String("I love China");                   //使用String的构造方法创建字符串
        s2 = new String("I love China");
        s3 = "I";                                      //使用字符串常量创建字符串
        s4 = "an";  
        s5 = "你好";
        s6 = "你好";
        System.out.println(s1.equals(s2));
        System.out.println(s1 == s2);                      // 对象引用的比较
        System.out.println(s2.startsWith(s3));
        System.out.println(s2.endsWith(s4));
        System.out.println(s5.equals(s6));
        System.out.println(s5 == s6);
    }
}
