I think the answer to this is simpler than it looks.
I will expand on what has been already said.
When we create a string with: String s1 = "AB";
We create one String object that is placed in the string pool and the variable s1 reference address will lead you straight to the string pool.
Expl:
String s1 = "AB"; // and
String s2 = "A" + "B";
"AB" already in the pool, s2 will refer to the same address in the pool.
On the other hand when we create a string with: String s3 = new String ("AB");
We create one string object placed in the pool, and one in the non-pool which s3 will reference.
Bottom line:
When second String s1 = �AB�; is created reference s1 points to the same string in the string pool.
When String s2 = new String(�AB�); is created �s2� points to the new separate object (non-pool)
cheers
[ July 23, 2003: Message edited by: Alex Radomski ]