czh500
冷囧囧
2018-12-29 14:56

java中String字符串的==双等号比较?

  • java

java中String字符串的==双等号比较?谁能帮忙解释和理解一下!顺便说一下底层的原理和运行规则?不吝赐教,谢谢!

public class Test {
    public static void main(String[] args) {
        String a = "hello2";
        final String b = "hello";
        String d = "hello";
        String c = b + 2;
        String e = d + 2;
        System.out.println((a == c));
        System.out.println((a == e));

    }

}

图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答