I've been studying for the SCJP5 exam and came across the following:
1)
String s1 = new String("abc");
2) StringBuilder s2 = new StringBuilder("abc");
Someone told me that line 2 is more efficient (in memory use) than line 1.
I know that StringBuilder makes better use of memory because it's not immutable, but it seems to me that line 2 by itself can't be more efficient than line 1, because:
line 1: creates one String object in the heap and another String object in the String constant pool because of the "abc".
line 2: creates one StringBuilder object in the heap and a String object in the String constant pool because of the "abc".
Am I right about this?