String s1 = "abc";
String s2 = new String("abc");
String s3=new String("abc");
How many objects would be there in the string pool....
One.
The String pool is a collection of String objects that have been interned. String literals are automatically interned. So, when the class containing this code is loaded, a String object will be created containing the character sequence ['a','b','c'], and it will be interned. All occurrences of the literal "abc" in this code will refer to the same String object.
With the following lines, two new Strings are created and initialized with the same character sequence. These strings are not pooled.
There will be
three distinct String objects created by this code, but only one of which will be pooled.
Hope this helps!

[ November 16, 2005: Message edited by: Steve Morrow ]