You will create two instances of String. Using string constructors, rather than declaring them as literals, will always create different instances.
Just try the following code:
String str = "abc"; String str2 = "abc"; String newString = new String(str); System.out.println("Are " + str + " and " + newString + " the same instance? " + (str == newString)); System.out.println("Are " + str + " and " + str2 + " the same instance? " + (str == str2));
source share