Skip to content

Instantly share code, notes, and snippets.

@sgnyjohn
Last active October 14, 2021 16:25
Show Gist options
  • Save sgnyjohn/b1812279fd8a73bd68a32e3068ac3e70 to your computer and use it in GitHub Desktop.
Save sgnyjohn/b1812279fd8a73bd68a32e3068ac3e70 to your computer and use it in GitHub Desktop.
openjdk11 bug
/*
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