well!!!i think here 3 string objects S1 ,S2 ,S3 will be created.... as though we can say three string references S1,S2,S3 will be created..... i hope it helps..............
I think there is only one string object, because they are stored differently, and the actual strings are reused, I forget what is is called, but i believe it is part of the reason why string are immutable.
So I think one String object in memory with 3 references.
I do believe that during compilation it probably creates something like 4 String objects as I was always told to create String with literals rather then new, because (in this example) the new commands creates a String and then a String object is created for the string liternal.
There are three "hello" literals, which are identical, so that is one object. There are two Strings set up to be equal to that object, so we still have one.
There is a "new String" in the 3rd line, which makes 2 Strings.
There are probably quiet a lot of other objects in the background which we don't notice.
Try
Don't get me started about those stupid light bulbs.