You create one object. The JVM will create another object off-screen because interns is a string created by a constant when the class is loaded, but this is the JVM thing (you did not ask for it intern
). And what's more, you can be pretty sure you did:
String s1 = new String("abcd");
once then
String s2 = new String("abcd");
.
JVM () String
: .class
. , .
, , String
. : , , .