"abc"
is a literal String.
In Java, these literal strings are pooled internally and the same String instance of "abc"
is used where ever you have that string literal declared in your code. So "abc" == "abc"
will always be true as they are both the same String instance.
Using the String.intern() method you can add any string you like to the internally pooled strings, these will be kept in memory until java exits.
On the other hand, using new String("abc")
will create a new string object in memory, which is logically the same as the "abc"
literal.
"abc" == new String("abc")
will always be false, as although they are logically equal they refer to different instances.
Wrapping a String constructor around a string literal is of no value, it just needlessly uses more memory than it needs to.