This content has been marked as final. Show 2 replies
One difference is that all String literals are shared in a string literal pool. This means all strings literals with the same content are the same object.
In this case a != b, a != b, a != c, a != d, a != e as the references are different, but b == d is true and b == e is true.
String a = new String("hi"); String b = "hi"; String c = new String("hi"); String d = "hi"; String e = c.intern();