ADDITIONAL SYSTEM INFORMATION : windows 10 A DESCRIPTION OF THE PROBLEM : When I use String a = new String("1") + new String("2"); then String b = "12"; when I compare a and b, I find that the output is false, then I try to put the above The splicing string changes the value, and the other changes are no problem. They are all true. Only when "12" returns false here, and when I change the version back to java8, there is no such problem. REGRESSION : Last worked in version 8u202 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : public static void main(String[] args) { String a = new String("1") + new String("2"); a.intern(); a.intern(); String b = "12"; System.out.println(a == b); } ACTUAL - false ---------- BEGIN SOURCE ---------- public static void main(String[] args) { String a = new String("1") + new String("2"); a.intern(); a.intern(); String b = "12"; System.out.println(a == b); } ---------- END SOURCE ---------- FREQUENCY : always
|