Last active
October 14, 2021 16:25
-
-
Save sgnyjohn/b1812279fd8a73bd68a32e3068ac3e70 to your computer and use it in GitHub Desktop.
openjdk11 bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
openjdk 11 | |
true 0 | |
false 0 | |
true 0 | |
true 0 | |
openjdk17 | |
true 0 | |
true 0 | |
true 0 | |
true 0/ | |
*/ | |
public class bugString { | |
static public void main(String p[]) { | |
String a = ""; | |
String b = "".substring(0); | |
String c = "1".substring(1); | |
System.out.println("" | |
+"\n"+(b==a)+" "+b.length() | |
+"\n"+(c==a)+" "+c.length() | |
+"\n"+(b.equals(a))+" "+b.length() | |
+"\n"+(c.equals(a))+" "+c.length() | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment