There are many questions on this in many forums but when you read every one of them, you actually go back to where you started!! As far as I've understood, for the example below:
1. String s = "abc" + "xyz";
...will create 3 objects right? "abc"(which is lost as no reference is assigned), "xyz"(lost) and "abcxyz"
2. String s = new String("def");
...will create 2 string objects. "def" and the one with the new operator
For 1, I hear that compile time resolves the string concatenation and only 1 object "abcxyz" gets created
For 2, I hear that when we use new, sometimes char[] containing its data is created which adds to the number of objects created!!
Please let me know if this is right.