Is a == b
always true
in all Java fully-compatible implementations?
String a = "abc";
String b = "abc";
if (a == b)
System.out.println("True");
I was asked if True
will be printed in a job interview. I was aware of that a
and b
could point to the same "abc"
as an optimization, but I was not sure if this optimization is standardized or it is jut a particular implementation behavior.