This content has been marked as final. Show 2 replies
Maybe someone could explain this to me.
a == b // true
I thought == compared the object reference, not the value.
Is == overloaded in the String objectNo
or are Strings created differently than other objects so the two different variables really are pointing at the same object?They're not created differently than other objects other than that here you didn't need to use the "new" keyword. They are referencing the same literal constant in the string pool.