Actually, I was wrong! The correct answer
is 3. After your last statement, I quickly saw what I missed. One of the String objects that is created isn't readily visible. Let's draw pictures to see what happens. As we're using String literals, I'm going to include the references created within the String constants table.
At this point, we have two references to this object. One by the variable s1 and one from the String constant table, I called it const1.
Now, we have three references to the same object.
Here is where I made my mistake. As the String literal "Pal" is used, a new object is created for that String and a reference is made to it from the String constant table. Then, this String in concatenated onto the existing object, which creates another new String object, which is referenced by s3.
Again, we add a reference to an existing object.
So, hopefully, you can see that there are, indeed, 3 String objects created. I guess my idea of counting String literals is shot.
If you have any more questions, please let me know.
Corey