新人问一个关于字符串是否相等的问题。谢谢!
Scanner in = new Scanner(System.in);String d = in.next();
String a = "byes";
String b = "byes";
String c = new String("byes");
System.out.println(a==b);
System.out.println(a==c);
System.out.println(a=="byes");
System.out.println(a.equals(b));
System.out.println(a==d);
为什么 a==b ,而a!=c;a!=d;d得到的也是"byes"字符串。