package com.sf._03_str;

public class Test {
    public static void main(String[] args) {
//        String name = "zhangsan";
//        name = "lisi";
//        System.out.println(name);
        String str = "123";
        String str1 = "123";

        String str2 = new String("123");
        String str3 = new String("123");
        // == 针对对象默认比较地址信息
        System.out.println(str == str1);    // true
        System.out.println(str2 == str3);   //false
        System.out.println(str == str2);    //false
        System.out.println(str1 == str3);   //false
        // String 当中equals 比较字符串的内容是否相同
        System.out.println(str.equals(str2)); //true
        System.out.println(str.equals(str1)); //true
    }
}
